How to reverse a string in mendix

0
How to reverse a string in mendix without using javaactions can anyone please explain in detail
asked
3 answers
2

Find the length of the string using that while loop with length > 0 and use substring(string, length-1, 1). 

answered
1

Hello, 

 

It could be possible if the String expressions had a function call ‘reverString’, which is not the case:

https://docs.mendix.com/refguide/expressions/#10-string-function-calls

 

A feasible way to do this avoiding the usage of Java is using JavaScript, called from a Nanoflow : 

 

The code for your convenience:

 

export async function reverseString(strToReverse) {
 // BEGIN USER CODE
 return new Promise((resolve, reject) => {
  return resolve(strToReverse.split("").reverse().join(""));
 } );
 // END USER CODE
}

 

answered
1

Hi yogendra jangid,
I would suggest creating a Java action and write your java code and return the Reversed String. 

Example Java link for REF: https://www.geeksforgeeks.org/reverse-a-string-in-java/

 

 

answered