• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Easy way to strip a leading character from a string
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Easy way to strip a leading character from a string


  • Subject: Easy way to strip a leading character from a string
  • From: Michelle Steiner <email@hidden>
  • Date: Fri, 19 Dec 2003 16:21:36 -0700

It's elementary, so I apologize in advance if I'm insulting anyone's intelligence with this.

-- Michelle

set foo to "00001234"
set strip_char to "0"
set foo to strip_leading_0(foo, strip_char)

to strip_leading_0(foo, strip)
repeat while first character of foo is strip
set foo to text 2 through end of foo
end repeat
end strip_leading_0

--
Homosexuals do not recruit; Christians recruit.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: what have the Romans ever done for us?
  • Next by Date: Re: Sorting IP addresses
  • Previous by thread: Mount volume problems
  • Next by thread: strange new error
  • Index(es):
    • Date
    • Thread