Created
April 8, 2013 15:05
-
-
Save blackraccoon000/5337488 to your computer and use it in GitHub Desktop.
IPアドレスを分割して再構築する試行錯誤①
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package FirstCase; | |
/** | |
* Created with IntelliJ IDEA. | |
* User: Yutaka Fujii | |
* Date: 13/04/08 | |
* Time: 22:29 | |
*/ | |
public class Exe { | |
public static void main(String args[]){ | |
String argsString = "192.168.11.1-200/10.0-10.0.200-220/172.16-30.8.100"; | |
String[] dataPeriod; | |
dataPeriod = PatturnSplit.splitPeriod(argsString); | |
for(int i=0;i<dataPeriod.length;i++){ | |
// System.out.println(i+": "+dataPeriod[i]); | |
String[] data; | |
data = NetworkSplit.splitSlash(dataPeriod[i],"\\."); | |
for(int j=0;j<data.length;j++){ | |
System.out.println(data[j]); | |
} | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package FirstCase; | |
/** | |
* Created with IntelliJ IDEA. | |
* User: Yutaka Fujii | |
* Date: 13/04/08 | |
* Time: 22:31 | |
*/ | |
public class NetworkSplit { | |
static String[] splitSlash(String argument,String sp){ | |
String[] splitArgs = argument.split(sp); | |
String[] splitData = new String[splitArgs.length]; | |
for(int i=0;i<splitArgs.length;i++){ | |
splitData[i] = splitArgs[i]; | |
} | |
return splitData; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package FirstCase; | |
/** | |
* Created with IntelliJ IDEA. | |
* User: Yutaka Fujii | |
* Date: 13/04/08 | |
* Time: 23:08 | |
*/ | |
public class PatturnSplit { | |
static String[] splitPeriod(String argsString){ | |
String[] dataPeriod; | |
dataPeriod = NetworkSplit.splitSlash(argsString,"/"); | |
// System.out.println(dataPeriod.length); | |
for(int i=0;i<dataPeriod.length;i++){ | |
// System.out.println(dataPeriod[i]); | |
return dataPeriod; | |
} | |
return null; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment