Split strings

SplitFirst(ByRef OutLeft, ByRef OutRight, InpText, InpSep)
{
  StringGetPos SepPos, InpText, %InpSep%, L
  If (SepPos >= 0)
  {
    StringLeft OutLeft, InpText, %SepPos%
    RemChars := StrLen(InpText)-SepPos-1
    StringRight OutRight, InpText, %RemChars%
  }
  Else
  {
    OutLeft  := InpText
    OutRight := ""
  }
}
 
SplitLast(ByRef OutLeft, ByRef OutRight, InpText, InpSep)
{
  StringGetPos SepPos, InpText, %InpSep%, R
  If (SepPos >= 0)
  {
    StringLeft OutLeft, InpText, %SepPos%
    RemChars := StrLen(InpText)-SepPos-1
    StringRight OutRight, InpText, %RemChars%
  }
  Else
  {
    OutLeft  := ""
    OutRight := InpText
  }
}

 
snippets/autohotkey/split-strings.txt · Last modified: 2009-02-03 21:58.52 by mbirth
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki Contents powered by Club-Mate Contents powered by BassDrive.com Labelled with ICRA