How to delete last char

后端 未结 5 1222
醉酒成梦
醉酒成梦 2021-01-12 15:24

How to delete last character of String with substring or anything ?

For example;

var
  query : String;
begin
  query:= \'test=1&line         


        
5条回答
  •  庸人自扰
    2021-01-12 15:53

    I actually was going to use this to another answer called "Delete last 5 characters from a string", probably not the best way to do this but it works for simple strings as #0 indicates a termination of a string.

    for your example

    Query[Length(Query)]:= #0;
    

    For the other topic example I can'nt reply on

    str[Succ(Length(str)) - 5]:= #0;
    showmessage(str);
    

    P.s I would vote HeartWare answer as that would be the more acceptable way to do this. I was just showing for simple strings a quick alternative that has the desired effects(mainly for the other topic conceringing deleting the last 5 chars)

提交回复
热议问题