Skip to content

Instantly share code, notes, and snippets.

@Fundibalus
Created May 4, 2017 09:16
Show Gist options
  • Save Fundibalus/31b96f1d3409df360ea5a421f5399842 to your computer and use it in GitHub Desktop.
Save Fundibalus/31b96f1d3409df360ea5a421f5399842 to your computer and use it in GitHub Desktop.
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package meintokenizer;
import java.util.ArrayList;
/**
*
* @author B201
*/
public class AndereTokenizer {
String tokenwort = "";
ArrayList<String> array = new ArrayList<>();
int counter = 0;
int index1 = 0;
int index2 = 0;
AndereTokenizer() {
}
AndereTokenizer(String token, String StringV) {
for (int i = 0; i < StringV.length(); i++) {
String buchstabe = StringV.charAt(i) + "";
if (buchstabe.equalsIgnoreCase(token)) {
index2 = StringV.indexOf(buchstabe);
String tokenwort = StringV.substring(index2, index1);
System.out.println(StringV);
} else {
tokenwort = tokenwort + buchstabe;
}
}
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package meintokenizer;
/**
*
* @author B201
*/
public class MeinTokenizer {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Tokenizer token = new Tokenizer(";", "Hallo;Ich;Liebe;");
System.out.println(token.nextToken());
System.out.println(token.nextToken());
AndereTokenizer tokenizer = new AndereTokenizer(";","Mein;Großes;haus;");
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package meintokenizer;
import java.util.ArrayList;
/**
*
* @author B201
*/
public class Tokenizer {
String tokenwort = "";
ArrayList<String> array = new ArrayList<>();
int counter = 0;
Tokenizer() {
}
Tokenizer(String token, String wort) {
for (int i = 0; i < wort.length(); i++) {
String buchstabe = wort.charAt(i) + "";
if (buchstabe.equalsIgnoreCase(token)) {
array.add(tokenwort);
tokenwort = "";
} else {
tokenwort = tokenwort + buchstabe;
}
}
}
public String nextToken() {
String diesertoken = array.get(counter);
counter++;
return diesertoken;
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package meintokenizer;
import java.util.ArrayList;
/**
*
* @author B201
*/
public class AndereTokenizer {
String tokenwort = "";
ArrayList<String> array = new ArrayList<>();
int counter = 0;
int index1 = 0;
int index2 = 0;
AndereTokenizer() {
}
AndereTokenizer(String token, String StringV) {
for (int i = 0; i < StringV.length(); i++) {
String buchstabe = StringV.charAt(i) + "";
if (buchstabe.equalsIgnoreCase(token)) {
index2 = StringV.indexOf(buchstabe);
String tokenwort = StringV.substring(index2, index1);
System.out.println(StringV);
} else {
tokenwort = tokenwort + buchstabe;
}
}
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package meintokenizer;
/**
*
* @author B201
*/
public class MeinTokenizer {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
Tokenizer token = new Tokenizer(";", "Hallo;Ich;Liebe;");
System.out.println(token.nextToken());
System.out.println(token.nextToken());
AndereTokenizer tokenizer = new AndereTokenizer(";","Mein;Großes;haus;");
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package meintokenizer;
import java.util.ArrayList;
/**
*
* @author B201
*/
public class Tokenizer {
String tokenwort = "";
ArrayList<String> array = new ArrayList<>();
int counter = 0;
Tokenizer() {
}
Tokenizer(String token, String wort) {
for (int i = 0; i < wort.length(); i++) {
String buchstabe = wort.charAt(i) + "";
if (buchstabe.equalsIgnoreCase(token)) {
array.add(tokenwort);
tokenwort = "";
} else {
tokenwort = tokenwort + buchstabe;
}
}
}
public String nextToken() {
String diesertoken = array.get(counter);
counter++;
return diesertoken;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment