<iframe src="https://www.googletagmanager.com/ns.html?id=GTM-M74D8PB" height="0" width="0" style="display:none;visibility:hidden">
Loading
Skip to NavigationSkip to Main Content

String Manipulation Using the Okta Expression Language

Single Sign-On

Overview

Manipulate strings using the Okta Expression Language (OEL) by applying specific string functions to format, extract, or modify data. Administrators can use these functions to customize user attributes and application mappings.

Applies To

  • Okta Classic Engine
  • Okta Identity Engine (OIE)
  • Okta Expression Language

Solution

Please check the video below for how to manipulate strings using the Okta Expression Language.

How are strings manipulated using the Okta Expression Language?

Identify the appropriate OEL string function, review the required input parameters, and apply the syntax to achieve the desired return type and output.

Function

Input parameter signature

Return type

example

Output

String.append

(String str, String suffix)

String

String.append("This is", " a test")

This is a test

String.join

(String separator, String... strings)

String

String.join(",", "This", "is", "a", "test")

This,is,a,test

 

 

 

String.join("", "This", "is", "a", "test")

Thisisatest

String.len

(String input)

Integer

String.len("This")

4

String.removeSpaces

(String input)

String

String.removeSpaces("This is a test")

Thisisatest

String.replace

(String input, match, replacement)

String

String.replace("This is a test", "is", "at")

That at a test

String.replaceFirst

(String input, match, replacement)

String

String.replaceFirst("This is a test", "is", "at")

That is a test

String.stringContains

(String input, String searchString)

Boolean

String.stringContains("This is a test", "test")

true

 

 

 

String.stringContains("This is a test", "doesn'tExist")

false

String.stringSwitch

(String input, String defaultString, String... keyValuePairs)

String

String.stringSwitch("This is a test", "default", "key1", "value1")

default

 

 

 

String.stringSwitch("This is a test", "default", "test", "value1")

value1

 

 

 

String.stringSwitch("First match wins", "default", "absent", "value1", "wins", "value2", "match", "value3")

value2

 

 

 

String.stringSwitch("Substrings count", "default", "ring", "value1")

value1

String.substring

(String input, int startIndex, int endIndex)

String

String.substring("This is a test", 2, 9)

is is a

String.substringAfter

(String input, String searchString)

String

String.substringAfter("abc@okta.com", "@")

okta.com

String.substringBefore

(String input, String searchString)

String

String.substringBefore("abc@okta.com", "@")

abc

String.toUpperCase

(String input)

String

String.toUpperCase("This")

THIS

String.toLowerCase

(String input)

String

String.toLowerCase("ThiS")

this

 

Related References

Loading
Okta Support - String Manipulation Using the Okta Expression Language