Substr Function

Official Content
This documentation is valid for:

To return a substring from a given string.

Syntax

Substr( s1n1, n2 )

Type Returned
Character

Where:
s1
   Must be a Character Expression.

n1 and n2 
   Must be Numeric Expressions. If n2 = 0 a null string is returned.

Description

Returns a substring of S1 beginning at position N1, with a length of N2 characters.

Constraints (not applicable to .NET, Java or Ruby):

1 <= s1 length <= 255
0 < n1 <= s1 length
n2 >= 0

Example

NoStr = SubStr('1234567890',5,2) // Result: NoStr = '56'

Scope

Objects: Procedures, Transactions, Web Panels
Languages: .NET, Java, Ruby, RPG, Cobol, Visual FoxPro

See Also

Substring Method
Concat function
Str function








Was this page helpful?
What Is This?
Your feedback about this content is important. Let us know what you think.