Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

reverse string

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 string

function reverseString(str) {
  let reversedStr = "";
  for (let i = str.length - 1; i >= 0; i--) {
    reversedStr += str[i];
  }
  return reversedStr;
}
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 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
Python :: think python 
Python :: python for loop inside list 
Python :: I**2 python 
Python :: how to get the user argent in django 
Python :: python seq 
Python :: how to open link in new tab selenium python 
Python :: exchange sort python 
Python :: how to make take command in python 
Python :: david dobrik 
Python :: how to sort by date in .csv 
Python :: python api with live ercot real time prices 
Python :: Use in in django while preserving order 
Python :: when training= false still dropout 
Python :: how to push the element to array in python 
Python :: line continutation in r string python 
Shell :: set git editor to vim 
Shell :: bitnami restart apache 
Shell :: upgrade pip 
Shell :: ad sync powershell 
Shell :: upgrade matplotlib version 
Shell :: remove valet from mac 
Shell :: uninstall material ui react 
Shell :: install xdotool ubuntu 
Shell :: conda install openpyxl 
Shell :: git list config 
Shell :: linux list files by size mb 
Shell :: how to know fedora version 
Shell :: heroku logs tail 
Shell :: conda install nodejs 
Shell :: linux check if a port is open 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =