string a = "String";
string b = a.Replace("i", "o"); // Strong
b = a.Insert(0, "My "); // My String
b = a.Remove(0, 3); // ing
b = a.Substring(0, 3); // Str
b = a.ToUpper(); // STRING
int i = a.Length; // 6
let message = 'good nite';
console.log(message.length);
// Prints: 9
console.log('howdy'.length);
// Prints: 5
let message = 'good nite';
console.log(message.length);
// Prints: 9
console.log('howdy'.length);
// Prints: 5
let message = 'good nite';
console.log(message.length);
// Prints: 9
console.log('howdy'.length);
// Prints: 5
let message = 'good nite';
console.log(message.length);
// Prints: 9
console.log('howdy'.length);
// Prints: 5
let message = 'good nite';
console.log(message.length);
// Prints: 9
console.log('howdy'.length);
// Prints: 5
let message = 'good nite';
console.log(message.length);
// Prints: 9
console.log('howdy'.length);
// Prints: 5
let message = 'good nite';
console.log(message.length);
// Prints: 9
console.log('howdy'.length);
// Prints: 5
import java.util.Scanner;
public class CodesCracker
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
System.out.print("Enter the String: ");
String str = scan.nextLine();
int len = str.length();
System.out.println("
Length of String = " +len);
}
}
//Methods used to obtain information about an object are known as accessor methods. One accessor method that you can use with strings is the length() method, which returns the number of characters contained in the string object.
Example
public class StringDemo {
public static void main(String args[]) {
String palindrome = "Dot saw I was Tod";
int len = palindrome.length(); // Using the length method
System.out.println( "String Length is : " + len );
}
}
let message = 'good nite';
console.log(message.length);
// Prints: 9
console.log('howdy'.length);
// Prints: 5
/**
* C program to find length of a string using strlen() function
*/
#include <stdio.h>
#include <string.h>
#define MAX_SIZE 100 // Maximum size of string
int main()
{
char text[MAX_SIZE]; /* Declares a string of size 100 */
int length;
printf("Enter any string: ");
gets(text);
/* Call strlen() function to count length of string */
length = strlen(text);
printf("Length of '%s' = %d", text, length);
return 0;
}