• <GetStart>
  • CSPro User's Guide
    • The CSPro System
    • Data Dictionary Module
    • The CSPro Language
    • Data Entry Module
    • Batch Editing Applications
    • Tabulation Applications
    • Data Sources
    • CSPro Statements and Functions
      • Statement Format Symbols
      • Alphabetical List of Functions and Statements
      • List of Reserved Words
      • Deprecated Features
      • Declaration Statements
      • Symbol Functions
      • Item Functions
      • Array Object
      • Audio Object
      • Barcode and QR Codes
      • Case Object
      • Document Object
      • File Object
      • Freq Object
      • Geometry Object
      • HashMap Object
      • Image Object
      • List Object
      • Map Object
      • Path
      • Pff Object
      • SystemApp Object
      • ValueSet Object
      • Program Control Statements
      • Assignment Statements
      • Data Entry Statements and Functions
      • Batch Edit Statements
      • Numeric Functions
      • String Functions
        • compare Function
        • compareNoCase Function
        • Concat Function
        • String Concatenation Operator
        • Edit Function
        • GetBuffer Function
        • Length Function
        • maketext Function
        • Message Formatting Options
        • Pos Function
        • PosChar Function
        • RegExMatch Function
        • Replace Function
        • StartsWith Function
        • Strip Function
        • ToLower Function
        • ToNumber Function
        • ToUpper Function
      • Multiple Occurrence Functions
      • General Functions
      • Date and Time Functions
      • External File Functions
      • Synchronization Functions
    • Templated Reporting System
    • HTML and JavaScript Integration
    • Action Invoker
    • Appendix
  • <CSEntry>
  • <CSBatch>
  • <CSTab>
  • <DataViewer>
  • <TextView>
  • <TblView>
  • <CSFreq>
  • <CSDeploy>
  • <CSPack>
  • <CSDiff>
  • <CSConcat>
  • <Excel2CSPro>
  • <CSExport>
  • <CSIndex>
  • <CSReFmt>
  • <CSSort>
  • <ParadataConcat>
  • <ParadataViewer>
  • <CSCode>
  • <CSDocument>
  • <CSView>
  • <CSWeb>

PosChar Function

Format
i = poschar(pattern_string, source_string);
Description
The poschar function searches for a collection of characters, represented in a pattern_string, within a source_string. The function returns the beginning position of the first occurrence of the pattern string in the source string. Both arguments are string expressions, and they are case sensitive, meaning that "c" is recognized as different from "C".
Return Value
The function returns the position of the first occurrence of the pattern string, or if no characters from the pattern string are found, the function returns 0.
Examples
VALUE = poschar("L", "CHILDREN");   // VALUE will be 4; this is where the
                                    // pattern string (the letter "L")
                                    // occurs in the source string ("CHILDREN")

VALUE = 
poschar("LCN", "CHILDREN"); // VALUE will be 1; of the characters in the
                                    // pattern string, "C" is the first character
                                    // encountered in the source string, and it is
                                    // found at position 1
See also: Pos Function, StartsWith Function, Replace Function, IsChecked Function