Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

string reverse

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

reverse a string

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 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
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

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 :: javascript how to reverse a string 
Javascript :: datatables on row created 
Javascript :: preload javascript 
Javascript :: javascript array move element one position 
Javascript :: how to remove character from string in javascript 
Javascript :: google map in react js 
Javascript :: js to uppercase 
Javascript :: javascript eval passing variable 
Javascript :: how to autoload config files added in composer.json laravel 
Javascript :: math round 
Javascript :: foreach javascript arrow function 
Javascript :: filter out object in array using two arguments 
Javascript :: e.target.text react 
Javascript :: set auth header on axios instance 
Javascript :: data not write in file node js 
Javascript :: javascript click on all links 
Javascript :: number format currency 
Javascript :: axios error 
Javascript :: is a letter javascript 
Javascript :: axios add no cors 
Javascript :: bootstrap time picker 12 hour format 
Javascript :: placeholder in angular 9 select 
Javascript :: how to compare two time in moment js 
Javascript :: javascript response redirect 
Javascript :: copy object array javascript 
Javascript :: express get remote ip 
Javascript :: ruby hash to json 
Javascript :: ajax file form 
Javascript :: javascript append child 
Javascript :: moment compare time 
ADD CONTENT
Topic
Content
Source link
Name
1+7 =