Official Content

Returns a substring from a given string.

Syntax

Substr(s1n1, n2)

Where:

s1
   Must be a Character Expression.

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

Type Returned:
Character

Scope

Objects: Procedure, Transaction, Web Panel, Panel, Data Provider
Generators: .NET, .NET FrameworkJava, RPG, Cobol, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3), Apple, Android, Angular

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

Samples

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

See Also

Substring method
Concat function
Str function







  

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant