掲示板システム
ホーム
アクセス解析
カテゴリ
ログアウト
Trimについて (ID:32598)
名前
ホームページ(ブログ、Twitterなど)のURL (省略可)
本文
>他に関数があるのでしょうか? なければ自前で、もちろんShiftJIS文字列限定 function TrimEx(const S: string): string; var I, L: Integer; begin L := Length(S); I := 1; while (I <= L) and ((S[I] <= ' ')or(S[I] = #$81)) do begin if (S[I] = #$81) then if (S[I+1] = #$40) then Inc(I) else Dec(I); Inc(I); end; if I > L then Result := '' else begin while (S[L] <= ' ')or(S[L] = #$40) do begin if (S[L] = #$40) then if (S[L-1] = #$81) then Dec(L) else Inc(L); Dec(L); end; Result := Copy(S, I, L - I + 1); end; end; procedure TForm1.Button1Click(Sender: TObject); begin Edit1.Text := TrimEx(#9#10' 123456 '); end;
←解決時は質問者本人がここをチェックしてください。
更新する
戻る
掲示板システム
Copyright 2021 Takeshi Okamoto All Rights Reserved.