Skip to main content

substring 문자열 위치 찾는법

#


#


package pro_04_08;

public class Test05 {

public static void main(String[] args) {
// TODO Auto-generated method stub
String name=new String();
name = "hello snow man";
char a='a';
//만약 문자의 위치를 찾고 싶을때
String temp=name.substring(0,5);
int temp1=name.length();
String temp3=name.substring(0, temp1-3);
System.out.println("헬로우 스펠링은 : "+ temp);
System.out.println("헬로우 스펠링 숫자는 : " + temp1);
System.out.println("헬로우 스노우 맨에서 맨을 뺀다면 ? " + temp3);




#


Comments