Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

string reverse

var str = "Your String";
var rev = string.Concat(str.Reverse());
Comment

string reverse

const reverseString = (str) => {
 
const revArray = [];
const length = str.length - 1;
  
// Looping from the end
for(let i = length; i >= 0; i--) {
    revArray.push(str[i]);
}
  
// Joining the array elements
return revArray.join('');



}

//if you find this answer is useful ,
//upvote ⇑⇑ , so can the others benefit also . @mohammad alshraideh ( ͡~ ͜ʖ ͡°)
Comment

Reverse a String

const reverse = str => str.split('').reverse().join('');

reverse('hello world');     
// Result: 'dlrow olleh'
Comment

Reverse an string Using Reversed function

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

reverse string

function reverseString(str) {
  let reversedStr = "";
  for (let i = str.length - 1; i >= 0; i--) {
    reversedStr += str[i];
  }
  return reversedStr;
}
Comment

Reverse a string

function reverseString(str) {
    return str.split('').reverse().join('');
}

reverseString('string');    // "gnirts"
Comment

String Reverse

const stringReverse = str => str.split("").reverse().join("");

stringReverse("Welcome to Javascript")
//tpircsavaJ ot emocleW
Comment

reverse a string

static string reverseString(string str){
            string output = "";
            int length = str.Length-1;
            for (int i = 0; i < length+1; i++)
            {
                output += str[length - i];

            }
            return output;
            
        } 
Comment

reverse a string

public static String reverse(String orig)
{
    char[] s = orig.toCharArray();
    int n = s.length;
    int halfLength = n / 2;
    for (int i=0; i<halfLength; i++)
    {
        char temp = s[i];
        s[i] = s[n-1-i];
        s[n-1-i] = temp;
    }
    return new String(s);
}
Comment

Reverse a String

sentence = "This is just a test"
reversed = sentence[::-1]
print(reversed)
Comment

Reverse an string Using Reversed function

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

Reverse string

// Reverse string

function reverseString(str) {
	let reverseStr = '';
	let i = str.length - 1;

	while (i >= 0) {
		reverseStr += str[i];
		console.log(reverseStr);
		i--;
	}
	return reverseStr;
}
reverseString('hello');

// OR

function reverseString(str) {
	for (var reversedStr = '', i = str.length - 1; i >= 0; i--) {
		reversedStr += str[i];
	}
	return reversedStr;
}

// OR

function reverseString(str( {
	result = ""
  	for (i = 0; i < str.length; i++) {
  		result = str[i] + result
  	}
  	return result 
}

// OR

function reverseString(str) {
	return str.split('').reverse().join('');
}
Comment

Reverse an string Using Reversed function

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

Reverse an string Using Reversed function

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

Reverse an string Using Reversed function

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

String reverse

String name = "gaurav";
    
    String reversedString = new StringBuilder(name).reverse().toString();
    
    System.out.println(reversedString);
Comment

Reverse string

# reverse string
st = 'Hello'
print(st[::-1])
Comment

Reverse an string Using Reversed function

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

Reverse an string Using Reversed function

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

Reverse an string Using Reversed function

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

Reverse an string Using Reversed

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

reverse a string

let t = s.chars().rev().collect::<String>();
Comment

reverse the string

#!/bin/bash
input="$1"
reverse=""
len=${#input}
for (( i=$len-1; i>=0; i-- ))
do 
	reverse="$reverse${input:$i:1}"
done
echo "$reverse"
Comment

reverse string

Input: s = ["h","e","l","l","o"]
Output: ["o","l","l","e","h"]
Comment

Reverse an string Using Reversed function

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

Reverse an string Using Reversed

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

reverse string

$text = 'Hello World'

$text = $Text.ToCharArray()
[Array]::Reverse($text)
-join $text
Comment

Reverse a String

class Reverse
{
    // Complete the function
    // str: input string
    public static String reverseWord(String str)
    {
        String rev = new String();
        for(int i = str.length()-1; i>=0; i--){
            rev += str.charAt(i);
        }
        return rev;
        // Reverse the string str
    }
}
Comment

reverse of string

def reverseWord():
  List = list(input().split(" "))
  updatedList= [x[::-1] for x in List]
  return str(' '.join(updatedList))
   
print(reverseWord())
Comment

Reverse an string Using Reversed

def reverse(string):
string = "".join(reversed(string))
return string
s = "SoftHunt"
print ("The original string is : ",end="")
print (s)
print ("The reversed string(using reversed) is : ",end="")
print (reverse(s))
Comment

PREVIOUS NEXT
Code Example
Javascript :: react moment calendar times 
Javascript :: react-tweet-embed 
Javascript :: react native login screen 
Javascript :: Session Time Out 
Javascript :: shopify template routing map 
Javascript :: javascript map replace key value 
Javascript :: javascript open method 
Javascript :: data attribute hide & show function syntax in jquery 
Javascript :: import an image in react 
Javascript :: how to run a react app 
Javascript :: Authentication handling in javascript 
Javascript :: location maps react native 
Javascript :: javascript extend object 
Javascript :: javasccript this.innerHTML 
Javascript :: promises in javascript 
Javascript :: clean-webpack-plugin clearing dist folder 
Javascript :: resize canvas 
Javascript :: nodelist to array 
Javascript :: web3.js tutorials 
Javascript :: event in javascript 
Javascript :: adding more than one class react 
Javascript :: why node_modules are not installed anymore 
Javascript :: clickable 
Javascript :: jsonArray find 
Javascript :: array index javascript 
Javascript :: js number in range 
Javascript :: javascript access map elements 
Javascript :: find in js 
Javascript :: javascript difference between window and Window 
Javascript :: post requests javascript 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =