1443
Views
5
Comments
Solved
How to remove the first and last character in string value?
Question

Hi everyone. 


So I wanted to remove the first and the last character in a value, it's a JSON format that I obtained from an API. Apparently it returned some escape strings that should be removed to deserialize the response. Example: 

"{\"20200619114321\":{\"absensi_date\":\"19-JUN-2020\",\"status_clock_out\":null}}"


I want to remove the double quote in the value. What function should I use? Replace? Substr? thanks.

2024-06-19 07-19-32
JitendraYadav
Solution

See below formula,

Val - your string.

SyntaxEditor Code Snippet

Substr(Val,1,Length(Val)-1)
2024-06-19 07-19-32
JitendraYadav

Aditya Eka Prabowo wrote:

Hi everyone. 


So I wanted to remove the first and the last character in a value, it's a JSON format that I obtained from an API. Apparently it returned some escape strings that should be removed to deserialize the response. Example: 

"{\"20200619114321\":{\"absensi_date\":\"19-JUN-2020\",\"status_clock_out\":null}}"


I want to remove the double quote in the value. What function should I use? Replace? Substr? thanks.


Hi,


Use Substr and Length function to remove first and last character from the string.


Thanks!

2024-06-19 07-19-32
JitendraYadav
2024-06-19 07-19-32
JitendraYadav
Solution

See below formula,

Val - your string.

SyntaxEditor Code Snippet

Substr(Val,1,Length(Val)-1)
2026-02-26 06-29-24
Rahul
 
MVP

hI aDITYA,

Based on your string you need to use this

SyntaxEditor Code Snippet

Substr(Txt,1,Length(Txt)-2)

where "txt" is your string.


regards

Rahul Sahu

UserImage.jpg
Aditya EP

Hi Jitendra and Rahul, thanks this problem is solved. Actually this is the alternative to my primary case, which leads to this post: https://www.outsystems.com/forums/discussion/62041/response-value-of-an-api-is-a-plaintext-can-i-create-a-list-from-it/


Anyway thanks again for the answers.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.