Results 1 to 10 of 10

Thread: How to check the last value in an edit box

  1. #1
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default How to check the last value in an edit box

    Is there any way to check the LAST value in an edit box?
    i.e.
    SCAR Code:
    EditBox.Text := 'ohai der';

    if(Edit.Box.text[7] = 'r')then

    I hope that explains it enough.

  2. #2
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    Quote Originally Posted by All that is man View Post
    Is there any way to check the LAST value in an edit box?
    i.e.
    SCAR Code:
    EditBox.Text := 'ohai der';

    if(Edit.Box.text[7] = 'r')then

    I hope that explains it enough.
    im sure that would work

    although the 7 would be a 10
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  3. #3
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Awkwardsaw View Post

    although the 7 would be a 10
    How do you figure?

  4. #4
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Awkwardsaw View Post
    im sure that would work

    although the 7 would be a 10
    He needs a way of finding the end value, rather than a set number. If the user enters a 5 char long then it be 5, but if its 9 then its 9 etc

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  5. #5
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    oo i gotcha

    length(edit.text);

    that or high(edit.text);

    ?
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  6. #6
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    function copy(s: string; ifrom, icount: LongInt): string;
    Returns part of the string (Copy('abcde',2,3) would return 'bcd'.
    function Length(s: string): LongInt;
    Returns string length in characters.
    Maybe that will help

    SL := Length(Edit.Text);
    Copy(Edit.Text, SL-1, SL);

    Not 100% sure tho.

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  7. #7
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    SCAR Code:
    var
      a: string;
      b: integer;
    begin
      a := 'ohai';
      b := length(a);
      writeln(a[b]);
    end.

    that ^^
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  8. #8
    Join Date
    Apr 2007
    Location
    UK
    Posts
    2,295
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yea or that :P Lol

    Rogeruk's Al-Kharid Tanner V1.1 [Released]
    Rogeruk's Barbarian Crafter [Coming Soon]
    Rogeruk's Guild Fisher [Coming Soon]
    !! - Taking Requests - !!

  9. #9
    Join Date
    Oct 2006
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    or this:

    Code:
    program New;
    
    var
      s: string;
      i: Integer;
    
    begin
      s := 'Hello There'
      i := Length(S)
      Writeln(Copy(s, i, 1)) ;
    end.

  10. #10
    Join Date
    May 2008
    Posts
    1,345
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Or this:

    SCAR Code:
    program New;

    var
      s: string;

    begin
      s := 'Hello There';
      Writeln(S[Length(S)]) ;
    end.

    ~Sand

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •