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 :: setstate in react 
Javascript :: reduce method in javascript array of bjects 
Javascript :: how to find the lowest number in an array in javascript for specific indexes 
Javascript :: vanilla js http server 
Javascript :: Next js Linking example 
Javascript :: iterate over array javascript 
Javascript :: express post 
Javascript :: nodejs express flash message 
Javascript :: Parse BSON to JSON 
Javascript :: url decoding js 
Javascript :: javascript querySelector change input value 
Javascript :: $out in mongodb 
Javascript :: dynamic forms in react 
Javascript :: math from string js 
Javascript :: defining schema mongoose 
Javascript :: shuffle array in javascript 
Javascript :: get file extension in javascript 
Javascript :: input show validation message 
Javascript :: javascript sign 
Javascript :: react native select option 
Javascript :: angular 11 features 
Javascript :: electron js hide on tray icon 
Javascript :: install axios nodejs 
Javascript :: javascript foreach loop array 
Javascript :: mui icons 
Javascript :: split() javascript 
Javascript :: js download 
Javascript :: delete request from the script to html 
Javascript :: mongoose limit skip 
Javascript :: defining functions in react 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =