for i := 1 to 5 do
  ShowMessage(s[i]);

解决方案 »

  1.   

    ss,s:string;
    ss:='asdfg'
    for i:=1 to 5 do
      begin
      s:=copy(s,i,1)
      用s;
      end;
      

  2.   

    str:string;
    strarr:array of string;Setlength(strarr,length(str));//给字符串指定长度
    For i:=low(strarr) to high(strarr) do
         strarr[i]=str[i];
    这样字符串的字符就涿个存在数组中去了。
      

  3.   

    str:string;
    strarr:array of string;Setlength(strarr,length(str));//给字符串指定长度
    For i:=low(strarr) to high(strarr) do
         strarr[i]=str[i];
    这样字符串的字符就涿个存在数组中去了。
      

  4.   

    楼上写的很好。.!!!string其实就是字符数组,可以通过下标来访问!!!!!
    string s ;s[0],s[1]....
      

  5.   

    楼上写的很好。.!!!string其实就是字符数组,可以通过下标来访问!!!!!
    string s ;s[0],s[1]....
      

  6.   

    楼上的朋友想法都不错,但都没有考虑到一个大问题,就是组成字符串的字符可能是双字节的,比如有中文的话,这些方法都行不通,看看我的做法吧,也许对你有所帮助 ^_^function GetCharFromString(src:string):string;
    var
      temp,mys:string;
      i:integer;
    begin
      i:=1;
      temp:='';
      mys:='';
      result:='';
      while i<length(src) do
      begin
        if ord(src[i]<127 then  //小于127,正常读取
        begin
          temp:=src[i];
          inc(i);
        end
        else begin  //当Ord(src[i])大于127时,证明这是一个双字节字符,因此需要将它和后面的一个连起来
          temp:=src[i]+src[i+1];
          inc(i,2);
        end;
        mys:=mys+temp+H13;
      end;
      result:=mys;
    end;这样,你用Showmessage等显示返回值时,将会看到每一行显示一个正确的字符,不会有乱码
    -------------------------------
    风过西窗客渡舟船无觅处
    年年一川新草遥看却似旧
      

  7.   

    Sorry 上面有两个地方打错了,
    1. 将第12行的“if ord(src[i]<127 then”改为“if ord(src[i])<127 then   丢了一个括号
    2.  将第22行的“mys:=mys+temp+H13”改为“mys:=mys+temp+#13”,H应改为#-------------------------------
    风过西窗客渡舟船无觅处
    年年一川新草遥看却似旧