Get Inspire insights from former attendees in our AMA discussion thread on Inspire Buzz. ACEs and other community members are on call all week to answer!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Access the n-th character of a string in a formula

Titouan
5 - Atom

Dear community,

 

It might be a nooby question but I couldn't find the answer on the forum.

 

I'm building a test module and I would like to check if the n-th character of a string is a " " (space). I couldn't find any easy way to extract this n-th character to check its value. Would you know a way ?

 

Thank you in advance !

5 REPLIES 5
andyuttley
11 - Bolide
11 - Bolide

Hi @Titouan 

 

You could use a formula to check this, such as:

 

"if Substring([YOURFIELD],3,1) = " " then 1 else 0 endif"

 

this would check the 4th character is " ", as an example

 

Andy  

klyuka
8 - Asteroid

iif (substring ([your_string], n-1, 1) = " "; 1; 0)

Titouan
5 - Atom

Oh of course .. Thank you 🙂

LordNeilLord
15 - Aurora

Hey @Titouan 

 

The easiest way is to split out the word into rows (using regex tokenize) and the see if the 9th row is a " "

LordNeilLord
15 - Aurora

@andyuttley 

 

Much simpler than my method!

Labels