Results 1 to 10 of 10

Thread: String manipulation (getting first 3 characters)

  1. #1
    Join Date
    May 2007
    Location
    Everywhere
    Posts
    1,428
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default String manipulation (getting first 3 characters)

    I don't know what's been carried over from scar. I checked Simba documentation and the String functions aren't commented so I feel as if I'm in the dark. (Wizzup, if you check this, please correct me if I'm wrong, I checked http://wizzup.org/simbadoc/ and the String functions werent documented besides what they do -- if there is full documentation somewhere, i'll take a link and read up on it)
    This is a purely simba script... no SCAR functions.

    For example, I want to get:
    Thank goodness you're here! My squire's dead, and

    The first 3 letters into a string, or a function that returns true if it finds 'Tha'. I can't just use "check if string = this' because it has apostrophe's in there which screws up my string. Unless there's a way to get rid of those
    Didn't realize how weak I am at modding strings...

    EDIT: I found this thread
    http://villavu.com/forum/showthread....ghlight=string
    Which solves my problem, but I'd still like to know if there are other string manipulation tools I could use.
    Last edited by Cstrike; 10-10-2010 at 02:37 AM.

  2. #2
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    You could use StrGet, if that's what the function name was?
    Or, there's also a possibility to do "String[1] + String[2] + String[3]", if you want a more clumsy way.

  3. #3
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    if(Pos('tha', 'thank goodness you're here! My squire''s dead, and') = 1) then
    // 'tha' is located at position 1 of the string!

    S := Copy('thank goodness you're here! My squire''s dead, and', 1, 3);
    // Copies from position 1 to 3 of a string
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  4. #4
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    Copy! It was Copy!
    Ah, thanks, Dan. StrGet must be from SCAR, then.
    .. it's obviously been a while since I've been doing this..

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

    Default

    Quote Originally Posted by EvilChicken! View Post
    Copy! It was Copy!
    Ah, thanks, Dan. StrGet must be from SCAR, then.
    .. it's obviously been a while since I've been doing this..
    copy was in SCAR aswell.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  6. #6
    Join Date
    Dec 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    4,603
    Mentioned
    15 Post(s)
    Quoted
    42 Post(s)

    Default

    Quote Originally Posted by EvilChicken! View Post
    Copy! It was Copy!
    Ah, thanks, Dan. StrGet must be from SCAR, then.
    .. it's obviously been a while since I've been doing this..
    There is no strget in anything (from what I know of).
    You may contact me with any concerns you have.
    Are you a victim of harassment? Please notify me or any other staff member.

    | SRL Community Rules | SRL Live Help & Chat | Setting up Simba | F.A.Q's |

  7. #7
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    strget is in PHP i think..
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  8. #8
    Join Date
    Sep 2006
    Posts
    6,089
    Mentioned
    77 Post(s)
    Quoted
    43 Post(s)

    Default

    StrGet gets a character at a certain position, like String[Index].
    Hup Holland Hup!

  9. #9
    Join Date
    Jan 2010
    Posts
    5,227
    Mentioned
    6 Post(s)
    Quoted
    60 Post(s)

    Default

    ^ Is it SCAR/SRL/Simba related though? I don't recall there being a StrGet function but then I kinda do then I kinda don't.

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

    Default

    SCAR Code:
    program New;
    var
      s : string;
     
    begin
      s := '5000';
      Writeln(StrGet(s, 4));
    end.

    In SCAR.

    Also, to add an apostrophe in a string it's just two of them (ie. '').

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
  •