1 package com.teamkonzept.publishing.markups; 2 3 7 public class TKMarkupFloatParamClass extends TKMarkupParamClass { 8 9 13 public String checkValue (String raw) { 14 if (raw == null){ 15 return raw; 16 } 17 18 String value = raw.trim(); 19 int pos = 0; 20 boolean isInt = true; 22 23 while (pos < value.length()) { 24 char chr = value.charAt (pos++); 25 26 if (chr == '.'){ 27 if (!isInt){ 28 return null; 29 } 30 else { 31 isInt = false; 32 } 33 } 34 else if (digitCodes.indexOf(chr) == -1){ 35 return null; 36 } 37 } 38 return value; 39 } 40 41 public int parseUnquotedValue (String text, int pos, StringBuffer value) 42 throws TKMarkupParserException { 43 44 if (value != null) value.setLength (0); 45 46 boolean isInt = true; 47 boolean isFloat = true; 48 49 while (pos < text.length()) { 50 51 char chr = text.charAt (pos); 52 53 if (chr == '.'){ 54 if (!isInt){ 55 isFloat = false; 56 } 57 else{ 58 isInt = false; 59 } 60 } 61 else if (digitCodes.indexOf(chr) == -1){ 62 isInt = false; 63 isFloat = false; 64 } 65 if (!isInt && !isFloat) break; 66 if (value != null) value.append (chr); 67 68 pos++; 69 } 70 return pos; 71 } 72 73 public String wrapValue (String value) { 74 75 return value; 76 } 77 } 78 79 | Popular Tags |