How to get last number

I am giving some text with numbers in .csv file like

Now i want to get last number only
means 1,2,3,4,...n
I am using code like
put item1 split by "abc" into item2
but i am not getting the value 1..
please suggest me


  • SenseTalkDougSenseTalkDoug ForumAdmin admin
    There are a number of ways to do this. To use the split operator like you're trying, you could do either of these:
    put value split by "abc" into (junk,item2)
    put value split by "abc" into (,item2)
    Or you could do this:
    put value into item2
    delete "abc" from item2
    If the number is always a single digit you could do:
    put the last character of value into theNumber
    Or if the first part of the value is always the same length you could do:
    put characters 4 to last of value into theNumber
    Hopefully one of those will work for you.
  • ToddTodd Member
    -- Oh so many ways to pin the tail ...

    set message to {{

    write line 2 of message
    write item -1 delimited by "abc" of message
    write char -1 of the last line of message
    write the last char of message
  • ToddTodd Member
    -- after some more thought, maybe too much

    set a to {{

    set a to items 2 to -1 of ( a split by abc ) -- empty/unquoted/non reserved words are treated as a string
    put item 1 of a -- return char is invisible, but there
    put charToNum(char -1 of item 1 of a) --> its 10 in value...
    put last item of a
Sign In or Register to comment.