Documentation for Win32lib v0.60.6
Table of Contents

Support Routines

Miscellaneous 'generic' routines used by win32lib


These routines can be used by many applications as they are not specific to the Win32Lib library.

  • proc registerRoutine(sequence pRoutineName, integer pRoutineId)   Registers a text string with an associated routine_id.
  • func w32abs( object a )   Absolute value.
  • func w32CType( integer pChar, object pSet)   Tests a character to see if it 'belongs' to a specified CharType set.
  • func w32Encode(sequence PlainText, sequence Mask, integer Size)   This routine transforms a string into an encoded form
  • func w32findKey( object key, sequence list )    Find the element in list that has key as its first element.
  • func w32findKeyEx( object key, sequence list, object element )   Find key in list using the depth indicated in element.
  • func w32GetCType( object pChar)   Gets the CharType for the specified character(s)
  • func w32get_bits( atom b32 )    Does the reverse of w32or_all() in that it gets all the bit values from an atom.
  • func w32hi_word( atom pData)    returns the high 16 bits of pData
  • func w32iff (atom test, object ifTrue, object ifFalse)   Used to embed an 'if' test inside an expression.
  • func w32insertElement( sequence list, integer pos, object item )    Inserts the object into the list at position pos
  • func w32lookup(object pItem, sequence pSource, sequence pTarget)   Returns the corresponding element.
  • func w32lo_word( atom pData)    returns the low-16 bits of pData
  • func w32or_all( object pData )    Calculates a binary OR against each element in pData
  • func w32pack_word( integer low, integer high )   Packs values into word.
  • func w32removeIndex( integer index, sequence list )    Remove the element at position index from the sequence list
  • func w32removeItem( object item, sequence list)    Removes item from the list, if it is in the list.
  • func w32replaceItem(sequence pList, object pOld, object pNew)    Replaces all occurances of pOld with pNew
  • func w32routine_id(sequence pRoutineName)    Returns the routine id for the registered routine pRoutineName
  • proc w32SetCType( object pChar, object pSet)    Sets one or more character types used by w32CType and w32GetCType
  • func w32shortInt( atom a )   Converts a number into a 16-bit signed integer
  • func w32signed_word( atom a )    Converts a into a signed 16-bit integer.
  • func w32split(sequence pSource, object pDelim)   Returns the undelimited substrings
  • func w32TextToNumber( sequence text )   This converts the text into a number.
  • func w32trim(object pSource)    Removes any whitespace chars from both ends of pSource
  • func w32trim_left(sequence pSource)    Removes any whitespace chars from the beginning of pSource
  • func w32trim_right(sequence pSource)    Removes any whitespace chars from the end of pSource

    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    registerRoutine
    (sequence pRoutineName, integer pRoutineId)

    Registers a text string with an associated routine_id.

    Category: Support Routines

    This is primarily used to add routines to an internal list so that w32start.ew can automatically find event handlers. However it can be used to link and text string to a routine_id, and later you can use w32routine_id() to retrieve the routine_id given the text string.

    Example:

      registerRoutine("Click_BigButton", routine_id("Click_BigButton"))
      registerRoutine("MainAction", routine_id("Click_BigButton"))
    

    rid = w32routine_id("MainAction") if rid != -1 then call_proc(rid, { . . . }) -- This calls Click_BigButton procedure. end if

    See Also: w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32abs
    ( object a )

    Absolute value.

    Returns: Absolute value of the atom or sequence.

    Category: Support Routines

    Example

           sequence s
           atom a
    

    a = w32abs(-1) -- = 1 s = w32abs({-2,-1,{-1,0,1},1,2}) -- = {2,1,{1,0,1},1,2}

    See Also: registerRoutine, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32CType
    ( integer pChar, object pSet)

    Tests a character to see if it 'belongs' to a specified CharType set.

    Returns: INTEGER: True False

    Category: Support Routines

    pChar is a single character.
    pSet is either a single CharType code or a set of codes.
    See w32SetCType for a complete list of valid CharType codes.

    Example:

          if w32CType( text[i], Alpha_CT) then
              ... process an alphabetic char
          elsif w32CType( text[i], Digit_CT) then
              ... process an digit char
          end if
    

    See Also: registerRoutine, w32abs, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32Encode
    (sequence PlainText, sequence Mask, integer Size)

    This routine transforms a string into an encoded form

    Returns: SEQUENCE: A set of Size ascii digits.

    Category: Support Routines

    This creates a one way hash based on the values of PlainText, Mask and Size. PlainText is usually a password entered in by a user.
    Mask is anything your application wishes to use to ensure that two identical PlainText values will generate different outputs. For example if this is used for passwords, the Mask could be the user's ID. Thus two people that just happen to have the same password cannot know that just by looking at the output of this function.
    Size is the number of encoded characters you wish returned. This can be any positive integer. The larger the Size the less chance that two different PlainText - Mask combinations will generate the same output. Values from 16 to 64 would be sufficient in nearly all cases.

    Example:

          sequence lCode
          lCode = w32Encode(PasswordText, UserID, 16)
    

    See Also: registerRoutine, w32abs, w32CType, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32findKey
    ( object key, sequence list )

    Find the element in list that has key as its first element.

    Returns: INTEGER: The index for the item that contains key. Zero if not found.

    Category: Support Routines

    The list must be a sequence of sequences. That is, each element in list must be a sequence containing at least one element. The key is the first element in each sub-sequence of list.

    Example:

          -- find a value from a list
          constant aList = { {"red", 17}, {"blue", 10}, {"orange", 299}, {"black", 0} }
          integer at
          at = w32findKey( "orange", aList )
          -- 'at' should now equal 3.
          at = w32findKey( "white", aList )
          -- 'at' should now equal 0.
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32findKeyEx
    ( object key, sequence list, object element )

    Find key in list using the depth indicated in element.

    Returns: INTEGER: The index for the item that contains key. Zero if not found.

    Category: Support Routines

    The element parameter specifies which sub-elements are to be inspected.

    Example:

          -- find a value from a list
          constant aList = { {"red", {17, 1, "ap"}}, {"blue", {10,3,"ef"}},
                             {"orange", {299, 9, "op"}}, {"black", {0,4, "yz"} } }
          integer at
          at = w32findKey( "op", aList, {2,3} )
          -- 'at' should now equal 3.
          at = w32findKey( 10, aList, {2,1} )
          -- 'at' should now equal 2.
          at = w32findKey( "gh", aList, {2,3} )
          -- 'at' should now equal 0.
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32GetCType
    ( object pChar)

    Gets the CharType for the specified character(s)

    Returns: Same datatype as pChar: The CharType code for the character(s)

    Category: Support Routines

    pChar can either be a single character or a sequence of characters.

    Example:

          object lRC
          -- Returns an integer containing the CharType Codes for 'a'
          lRC = w32GetCType('a')
          -- Returns a sequence containing the CharType Codes for 'a', '1' and '$'
          lRC = w32GetCType("a1$")
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32get_bits
    ( atom b32 )

    Does the reverse of w32or_all() in that it gets all the bit values from an atom.

    Returns: Sequence: The non-zero bits set in b32.

    Category: Support Routines

    Typically used to extract which bits have been set on in a flag.

    Example:

    -- combine flags
    integer flags
    sequence codes
    codes = w32get_bits( origflag )
    if find(WS_EX_CLIENTEDGE, codes) then
    setText(statusarea, "Client Edge has been specified")
    end if
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32hi_word
    ( atom pData)

    returns the high 16 bits of pData

    Returns: INTEGER: Bits 31-16 of the parameter as a 16 bit value.

    Category: Support Routines

    Example:

    integer y
    y = w32hi_word( bigval )
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32iff
    (atom test, object ifTrue, object ifFalse)

    Used to embed an 'if' test inside an expression.

    Returns: If test is true then ifTrue is returned otherwise ifFalse is returned.

    Category: Support Routines

    Example

             msg = sprintf("%s: %s", {
                          w32iff(ErrType = 'E', "Fatal error", "Warning"),
                          errortext } )
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32insertElement
    ( sequence list, integer pos, object item )

    Inserts the object into the list at position pos

    Returns: The list with the item inserted.

    Category: Support Routines

    The new element becomes the pos

    This routine also handles positions less than 1. If pos < 1 then it will be changed to length(list)+pos+1, meaning that a value of 0 will add to the end of the list, -1 just before the end, etc... If the recalculated pos is less than 1 then the element is added to the front of the list.

    Example

         -- Insert the name 'fred' before the 3rd element in the list.
         nameList = w32insertElement(nameList, 3 , "fred")
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32lookup
    (object pItem, sequence pSource, sequence pTarget)

    Returns the corresponding element.

    Returns: OBJECT: The corresponding element or 0/{} if not found.

    Category: Support Routines

    This searches pSource for pItem and if found, it returns the corresponding element from pTarget.
    If pItem is not found in pSource, then what is returned depends on a few things.
    If pTarget is longer than pSource then the last element in pTarget is returned. This implements a way to return a default value of your choosing.
    If pTarget is not longer than pSource then if the first element of pTarget is an atom then zero is returned otherwise an empty sequence is returned.

    Examples:

           x = w32lookup('a', "cat", "dog") --> 'o'
           x = w32lookup('d', "cat", "dogx") --> 'x'
           x = w32lookup('d', "cat", "dog") --> 0
           x = w32lookup("ape", {"ant","bear","cat"}, {"spider","seal","dog"}) --> ""
           x = w32lookup("ant", {"ant","bear","cat"}, {"spider","seal","dog"}) --> "spider"
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32lo_word
    ( atom pData)

    returns the low-16 bits of pData

    Returns: INTEGER: Bits 15-0 of the parameter

    Category: Support Routines

    Example:

    integer y
    y = w32lo_word( bigval )
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32or_all
    ( object pData )

    Calculates a binary OR against each element in pData

    Returns: ATOM: The OR'd value

    Category: Support Routines

    example:

          atom flags
          flags = w32or_all({WS_CHILD, WS_VISIBLE, WS_BORDER})
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32pack_word
    ( integer low, integer high )

    Packs values into word.

    Returns: ATOM: 32 bit word with low value in low 16 bits, high value in high 16 bits.

    Category: Support Routines

    Typically used to encode a message parameter into a 32 bit word.

    Example:

    -- pack min and max into parameter
    integer y
    lParam = w32pack_word( min, max )
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32removeIndex
    ( integer index, sequence list )

    Remove the element at position index from the sequence list

    Returns: The list without the element.

    Category: Support Routines

    If index is greater than the list length, the list is returned intact. If index is less than 1, it represents the end of the list PLUS the index. So an index of '-1' means the second-last element.

    Example:

          -- Remove the 4th element from the Name List
          nameList = w32removeIndex( 4, nameList )
          -- Remove the last element.
          nameList = w32removeIndex( 0, nameList )
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32removeItem
    ( object item, sequence list)

    Removes item from the list, if it is in the list.

    Returns: The list without the item.

    Category: Support Routines

    Example

         -- Remove the name 'fred' from the list.
         nameList = w32removeItem("fred", nameList)
    
    --------------------------------------------------------------------------

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32replaceItem
    (sequence pList, object pOld, object pNew)

    Replaces all occurances of pOld with pNew

    Returns: SEQUENCE: Updated pList.

    Category: Support Routines

    Note this routine will not do recursive replacements. That is, if pNew contains pOld, it doesn't go into a never-ending loop.

    Example:

      sequence lRes
      lRes = w32replaceItem("a;b;c;d;e", ";", " ; ")
      -- gives "a ; b ; c ; d ; e"
      lRes = w32replaceItem("The ^^ word is correct", "^^", "third")
      -- gives "The third word is correct"
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32routine_id
    (sequence pRoutineName)

    Returns the routine id for the registered routine pRoutineName

    Returns: INTEGER: The routine id or -1 if pRoutineName is not registered.

    Category: Support Routines

    This can only find routines that have been registered via registerRoutine() and is used by w32Start.ew to automatically set handlers based on the standard naming convention for even handlers.

    Example:

      integer id
      id = w32routine_id( EventType & "_" & ControlName )
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    w32SetCType
    ( object pChar, object pSet)

    Sets one or more character types used by w32CType and w32GetCType

    Category: Support Routines

    pChar is the character(s) to set. This can take the form of a single character such as 'A', a list of characters such as "1234567890", or a range of characters such as {"a", "z"}.
    pSet is either a single CharType code or a list of CharType codes.
    The valid CharType codes are ...

  • Control_CT
  • Alpha_CT
  • Digit_CT
  • Punct_CT
  • Symbol_CT
  • White_CT
  • Lowercase_CT
  • Uppercase_CT
  • Printable_CT
  • NameChar_CT
  • User1_CT
  • User2_CT
  • User3_CT
  • User4_CT
  • User5_CT
  • User6_CT
  • AlphaNumeric_CT (a combination of Alpha_CT and Digit_CT)

    Example:

          w32SetCType( 255, User1_CT) -- Single char
          w32SetCType( {"n","z"}, User3_CT ) -- Range of chars
          w32SetCType( "13579", User2_CT ) -- List of chars
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32shortInt
    ( atom a )

    Converts a number into a 16-bit signed integer

    Returns: INTEGER: The value of a as a short int.

    Category: Support Routines

    Typically used to decode Win32 message values

    Example:

    -- Mouse Position
    sequence hilo, x, y
    hilo = upack_word( lParam )
    x = w32shortInt(hilo[2])
    y = w32shortInt(hilo[1])
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32signed_word
    ( atom a )

    Converts a into a signed 16-bit integer.

    Returns: INTEGER: Signed 16 bits of a 32 bit word.

    Category: Support Routines

    Typically used to decode Win32 message values when several values are packed into a single number.

    Example:

    -- extract the low portion from lParam
    integer x
    x = w32signed_word( lParam )
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32split, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32split
    (sequence pSource, object pDelim)

    Returns the undelimited substrings

    Returns: SEQUENCE: A set of sequences, one per delimited substring in pSource

    Category: Support Routines

    pSource is the sequence from which to extract the substrings.
    pDelim is the delimiter character, delimiter string, or a set of single character delimiters.

    Note 1 - if pDelim is an atom and not equal to '{' then sections of text enclosed in matching '{' and '}' are not scanned.
    Note 2 - if pDelim is a single string inside a sequence, then it is considered to be a set of delimiter characters and any one of them can delimiter the pSource. The results in this case are that each delimitered text is followed by the sequence containing the character that caused the delimitation. A final empty sequence means that no delimiter was found to end the pSource text.

    Example:

      sequence result
      result = w32split("if abc = def then xyz()", ' ')
      ? result  -- Should be {"if","abc","=","def","then","xyz()"}
    

    -- Example of embedded delimiter... result = w32split("event=Click,font={Courier,12}", ',') ? result -- Should be {"event=Click","font={Courier,12}"}

    -- Example of delimiter set... result = w32split("event=Click,font={Courier,12}", {"=,{}"}) ? result -- Should be {"event","=","Click",",","font","=","","{","Courier",",","12","}"}

    ----------------------------------------------------

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32TextToNumber, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32TextToNumber
    ( sequence text )

    This converts the text into a number.

    Returns: Atom: The number represented by the text.

    Category: Support Routines

    If the text contains invalid characters, zero is returned.

    Note 1: You can supply Hexadecimal values if the value is preceded by a '#' character, Octal values if the value is preceded by a '@' character, and Binary values if the value is preceded by a '!' character. With hexadecimal values, the case of the digits 'A' - 'F' is not important. Also, any period character embedded in the number is used with the correct base.

    Note 2: Any underscore or comma characters, that are embedded in the text number are ignored. These can be used to help visual clarity for long numbers.

    Note 3: You can supply a leading or trailing, minus or plus sign.

    Note 4: You can supply trailing percentage sign(s). Each one present causes the resulting value to be divided by 100.

    Note 5: Any single currency symbol to the left of the first digit is ignored.

    This function can optionally return information about invalid numbers. If text has the form of {sequence, integer} then if the integer is nonzero, a sequence is returned. The first element is the value converted, and the second is the position in the text where conversion stopped. If no errors were found then this is zero.

         sequence rc
         atom   val
         rc = w32TextToNumber({"12.34a", 1})
         --  rc ---> {12.34, 6} -- Error at position 6
         rc = w32TextToNumber({"12.34", 1})
         --  rc ---> {12.34, 0} -- No errors.
    

    val = w32TextToNumber("12.34a") -- val ---> 0

    val = w32TextToNumber("#f80c") --> 63500 val = w32TextToNumber("#f80c.7aa") --> 63500.47900390625 val = w32TextToNumber("@1703") --> 963 val = w32TextToNumber("!101101") --> 45 val = w32TextToNumber("12_583_891") --> 12583891 val = w32TextToNumber("12_583_891%") --> 125838.91 val = w32TextToNumber("12,583,891%%") --> 1258.3891

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32trim, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32trim
    (object pSource)

    Removes any whitespace chars from both ends of pSource

    Returns: The original sequence with the matching characters removed.

    Category: Support Routines

    pSource is the sequence from which to remove whitespace.
    If pSource is enclosed in quotes (single or double) they are removed. This is a way to force leading and/or trailing whitespace Example:

           sequence result
           result = w32trim("  abc def  ")
           ? result  -- Should display "abc def"
           result = w32trim("\"  abc def  \"")
           ? result  -- Should display "  abc def  "
    
    ----------------------------------------------------

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim_left, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32trim_left
    (sequence pSource)

    Removes any whitespace chars from the beginning of pSource

    Returns: The original sequence with the matching characters removed.

    Category: Support Routines

    pSource is the sequence from which to remove whitespace.
    Example:

           sequence result
           result = w32trim_left("  abc def  ")
           ? result  -- Should display "abc def  "
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_right


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    w32trim_right
    (sequence pSource)

    Removes any whitespace chars from the end of pSource

    Returns: The original sequence with the matching characters removed.

    Category: Support Routines

    pSource is the sequence from which to remove whitespace.
    Example:

           sequence result
           result = w32trim_right("  abc def  ")
           ? result  -- Should display "  abc def"
    

    See Also: registerRoutine, w32abs, w32CType, w32Encode, w32findKey, w32findKeyEx, w32GetCType, w32get_bits, w32hi_word, w32iff , w32insertElement, w32lookup, w32lo_word, w32or_all, w32pack_word, w32removeIndex, w32removeItem, w32replaceItem, w32routine_id, w32SetCType, w32shortInt, w32signed_word, w32split, w32TextToNumber, w32trim, w32trim_left