Explore
ProGrad Programs
About Us

Edit
Reply




Edit

String operations in C, C++, Java and Python | FACE Prep

Published on 11 Mar 2020

Program to perform all the basic string operations is discussed here. Some of the basic operations are printing the string, printing the length of the string, reversing a string, concatenating two strings, and so on.


For example, consider two strings

str1 = "Focus"

str2 = "Academy"

Length of str1 is 5

Length of str2 is 7

Reverse of str1 is sucoF

Reverse of str2 is ymedacA

Concatenation of str1 and str2 is FocusAcademy


String Operations | Program to print a string


C
C++
Java
Python 3

Output
Enter the string : Focus
The string is : Focus


String Operations | Program to print the length of a string


C
C++
Java
Python 3

Output
Enter the string : Focus
The length of Focus is 5


String Operations | Program to copy a string


C
C++
Java
Python 3

Output
Enter string : Focus
String 1 : Focus
String 2 : Focus


String Operations | Program to reverse a string


C
C++
Java
Python 3

Output
Enter the string : Focus
Reversed String : sucoF


String Operations | Program to concatenate two strings


C
C++
Java
Python 3

Output
After concatenation : FacePrep


String Operations | Program to compare two strings


C
C++
Java
Python 3

Output
Enter the string 1 : Focus
Enter the string 2 : Focas
The strings are not equal


Recommended Programs






If you have any feedback about this article and want to improve this, please write to enquiry@faceprep.in
Explore 'c'
Articles