Tags » Substring

PHP-strpos function

The strpos function in PHP is used to determine whether a string is contained in another string.

For Example

If there is a string A that contains the following words “The cat is sleeping” and you have another string B that contains this “cat” 81 more words

Web Development

Evaluate

  1.  int a=10, b=8;

(i) a%b++

(ii) ++a-b–

(iii) a++ – b–

(iv) a– + b++

Output:

  1.  a% b= 10 % 8 = 2 (% is to find the remainder)
  2. 14 more words
Education

Program for subString()

import java.util.Scanner;
public class Strings_SubString 
{
 public static String subString(String s , int start ,int end)
 {
 char[] ch = s.toCharArray();
 String res = "";
 for (int i = start; i < end; i++) 
 {
 res = res + ch[i];
 }
 return res;
 }
 public static void main(String[] args) 
 {
 Scanner sc = new Scanner(System.in);
 System.out.println("Enter the String :- ");
 String s1 = sc.nextLine();
 System.out.println("Enter the starting index :- ");
 int a = sc.nextInt();
 System.out.println("Enter the ending index :- ");
 int b = sc.nextInt();
 System.out.println(subString(s1,a,b));
 sc.close();
}
}
Strings

Getting a Substring in MySQL

I just learned how to get substring of specific range using LOCATE() and SUBSTRING().

Let’s say we have email addresses and want to get username part from them. 53 more words

Programming

Splitting a string & looping through results using subString&lastIndexof functions in Java

Substring: java string substring () method returns a part of the string.

Lastindex of: java string lastIndexOf () method returns the last index of the given character value or substring. 104 more words

Software

Shuffle characters of a string in SQL Server

For security-related reasons or for puzzle related circumstances, we may need to shuffle characters in a string. Here I am describing how to do that in SQL Server. 311 more words

Technology