how can i reverse text (client side)
if i have input text : wsda
i need the output : adsw
Is there any idea
Hi Andrew ,
I hope it will be helpful for you .You can use below javascript.
var string = "erehT era a tsav rebmun fo secruoser rof gninrael erom tpircsavaJ"; // you can split, reverse, join " " first and then "" too string.split("").reverse().join("").split(" ").reverse().join(" ")
Please check by below url and attached OML File.
https://rahuljain877.outsystemscloud.com/home/Screen1
If I want to reverse the first five letters only, and the rest is displayed as it is entered
How can I do this
Please find updated OML File
Hello @andrew mahfouz,
The forge component suggested above is a great fit especially as it has several other features you can use.
If for any reason you are not inclined to use a forge component for this particular need then you can do it yourself in as few steps as shown below. If interested, feel free to review the attached oml.
Regards,
AJ
Hi @andrew mahfouz,
In your new request, you want only the first 5 letters (characters I presume?) to be reversed, but looking at the example you provided Manish Gupta (screenshot below) you actually need the first 6 characters to be reversed, to get the output you desire.
The attached updated OML gives you the flexibility to decide how many characters from the start of the string, should be reversed. Result of the attached oml shown below:
Cheers,
Hello Andrew
With the client side do you mean with JavaScript?
Please look into this demo if it works for you - https://personal-9qwkrkgl.outsystemscloud.com/ForumHelp/ReverseString?_ts=637594334984186669
Type any string and click on Reverse.
Umm, like this - https://personal-9qwkrkgl.outsystemscloud.com/ForumHelp/ReverseString ??
i need if i enterd : andre mhafouz
the output will be : mhafouz erdna
how can i do that
Here is another JavaScript solution that does not require 2 reverse, a split and a join, and should perform faster.
It has one client action wrapping the following JavaScript recursive function:
function reverseString(str) { return (str === '') ? '' : reverseString(str.substr(1)) + str.charAt(0); }
Andrew, this is not the first time you ask something, the the community comes and help you, then you change your question. Please value our (volentary) time to help you and ask the question right the first time.
Hi andrew
The easy way will be to use a forge such as below.
https://www.outsystems.com/forge/component-overview/5107/string-utilsIf you are familiar with C#, then you can make your own extension.
var rev = new string(s.Reverse().ToArray());
Kind regards