[re]µÎ ¼ýÀÚÀÇ °¢ ÀÚ¸®¼ö¸¦ ºñ±³Çϱâ


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :Ãֱ⼷ 2000³â 4¿ù 24ÀÏ 17:04:51

In Reply to: µÎ ¼ýÀÚÀÇ °¢ ÀÚ¸®¼ö¸¦ ºñ±³Çϱâ posted by ÇöÁ¤ on 2000³â 4¿ù 24ÀÏ 02:43:06:

Áú¹®ÇϽŠ³»¿ëÀ» ó¸®ÇÏ´Â ÇÔ¼ö¸¦ ¸¸µé¾î ºÃ½À´Ï´Ù.
¹è¿­·Î ¸¸µé±âº¸´Ù´Â char String.charAt(int)¸¦ »ç¿ëÇÏ´Â°Ô ³ªÀ» µí ½Í½À´Ï´Ù.


public void compare(String one, String another) {


int oneLength = one.length();
int anotherLength = another.length();


// µÎ °ªÀÇ ±æÀÌ°¡ ´Ù¸£¸é ±ä ÂÊÀÇ ¾Õ¿§ °ÍÀ» ÀÚ¸¥´Ù.
if ( oneLength > anotherLength )
one = one.substring( oneLength-anotherLength, oneLength);
else
another = another.substring( anotherLength-oneLength, anotherLength);


String result = null;
for ( int i=0; i<one.length(); i++ ) {
if ( one.charAt( i) == another.charAt( i) )
result = "°°´Ù.";
else
result = "´Ù¸£´Ù.";


System.out.println( (i+1) + "¹ø°ÀÚ¸®(" + one.charAt( i) + ", " +
another.charAt( i) + ")´Â " +
result);
}
}


´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
HTML ÅÂ±× Æ÷ÇÔ ¿©ºÎ: HTML ¹®¼­ÀÏ °æ¿ì üũ
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]