String Functions

String Functions

Function Name

.NET Method

Example

CHRW

VisualBasic.Strings.ChrW

select description + chrw(13) + cpu + chrw(13) + memory from [item_info]

Equivalent to SQL-Server CHAR and NCHAR functions.

ASCII

VisualBasic.Strings.AscW

select ASCII('test'), ASCII(NULL)

LOWER

VisualBasic.Strings.LCase

select lower(description) from [item_info]

LTRIM

VisualBasic.Strings.LTrim

select ltrim(description) from [item_info]

RTRIM

VisualBasic.Strings.RTrim

select rtrim(description) from [item_info]

TRIM

VisualBasic.Strings.Trim

select trim(description) from [item_info]

UPPER

VisualBasic.Strings.UCase

select upper(description) from [item_info]

REPLACE

System.String.Replace

SELECT replace('abcdefghicde','cde','xxx'), replace('abcdefghicde','CDE','xxx')


Note that Replace is case-sensitive.

SUBSTRING

System.String.Substring

SELECT SUBSTRING('abcdefghicde', 1, 3)

CHARINDEX

System.String.IndexOf

SELECT charindex('abc', 'xyzabc123')

LEN

VisualBasic.Strings.Len

SELECT [len]('test')

LEFT

VisualBasic.Strings.Left

SELECT [left]('test', 2)

RIGHT

VisualBasic.Strings.Right

SELECT [right]('test', 2)