Line | |
---|
1 | package org.expeditee.io;
|
---|
2 |
|
---|
3 | public class TexEnvironment {
|
---|
4 | private String _comment = "";
|
---|
5 |
|
---|
6 | private String _name = "";
|
---|
7 |
|
---|
8 | public TexEnvironment(String s) {
|
---|
9 | int colonPos = s.indexOf(':');
|
---|
10 |
|
---|
11 | if (colonPos > 0) {
|
---|
12 | _name = s.substring(0, colonPos).trim();
|
---|
13 | if (s.length() > colonPos + 1)
|
---|
14 | _comment = s.substring(colonPos + 1).trim();
|
---|
15 |
|
---|
16 | for (int i = 0; i < _name.length(); i++) {
|
---|
17 | if (!Character.isLetter(_name.charAt(i))) {
|
---|
18 | _name = "";
|
---|
19 | }
|
---|
20 | }
|
---|
21 | }
|
---|
22 | }
|
---|
23 |
|
---|
24 | public boolean isValid() {
|
---|
25 | return _name != "";
|
---|
26 | }
|
---|
27 |
|
---|
28 | public String getComment() {
|
---|
29 | return _comment;
|
---|
30 | }
|
---|
31 |
|
---|
32 | public String getName() {
|
---|
33 | return _name;
|
---|
34 | }
|
---|
35 |
|
---|
36 | public boolean hasComment() {
|
---|
37 | return _comment != "";
|
---|
38 | }
|
---|
39 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.