-
a: argumentString value: aValue [format]
"self new a: '10' value: 'abc'."
"self new a: '' value: 'abc'."
"self new a: '3' value: 'abcdefgh'."
^JunStringUtility a: argumentString value: aValue
-
assert: assertBlock do: doBlock ensure: ensureBlock [private]
assertBlock value.
[doBlock value]
ensure: [ensureBlock value]
-
baseName [accessing]
^ChemoJunAbstractObject baseNameFromFilename: self fileName
-
e: argumentString value: aValue [format]
^JunStringUtility e: argumentString value: aValue
-
extension [accessing]
^ChemoJunAbstractObject extensionFromFilename: self fileName
-
f: argumentString value: aValue [format]
"self new f: '10.4' value: 1234.567."
"self new f: '' value: 1234.567."
"self new f: '3' value: 1234.567890."
^JunStringUtility f: argumentString value: aValue
-
fileName [accessing]
^fileName
-
fileName: aFilename [accessing]
fileName := aFilename asFilename
-
format: aString value: aValue [format]
"self new format: 'a10' value: 'abc'."
"self new format: 'f10.4' value: 1234.567."
"self new format: 'x10' value: nil."
^JunStringUtility format: aString value: aValue
-
getChar: aStream [private]
^JunStringUtility getChar: aStream
-
getLine: aStream [private]
^JunStringUtility getLine: aStream
-
i: argumentString value: aValue [format]
"self new i: '10' value: 1234567."
"self new i: '' value: 1234567."
"self new i: '3' value: 1234567890."
^JunStringUtility i: argumentString value: aValue
-
initialize [initialize-release]
fileName := nil
-
pathName [accessing]
^(Filename splitPath: self fileName asString) first
-
separate: separateCollection [private]
^self separate: separateCollection dividers: self separators
-
separate: separateCollection dividers: dividerCollection [private]
^JunStringUtility separate: separateCollection dividers: dividerCollection
-
separators [private]
| stream |
stream := WriteStream on: (String new: 10).
stream nextPut: Character space.
stream nextPut: Character tab.
stream nextPut: Character cr.
stream nextPut: Character lf.
^stream contents
-
setFileName: aFilename [private]
fileName := aFilename
-
skipSeparators: aString [private]
"self new skipSeparators: ' zzz'."
| subString |
subString := aString copyFrom: 1 to: aString size.
[subString isEmpty not and: [subString first isSeparator]]
whileTrue: [subString := subString copyFrom: 2 to: subString size].
^subString
-
x: argumentString [format]
"self new x: '10'."
"self new x: ''."
^JunStringUtility x: argumentString
-
z: argumentString value: fixedPointValue [format]
"ChemoJunAbstractFile new z: '10.4' value: 1234.567s."
"ChemoJunAbstractFile new z: '' value: 1234.567s."
"ChemoJunAbstractFile new z: '3' value: 1234.567890s."
"ChemoJunAbstractFile new z: '10.4' value: 1s."
| collection length decimal string stream index |
collection := JunStringUtility separate: argumentString
dividers: JunStringUtility separators , '.'.
collection isEmpty
ifTrue:
[length := 10.
decimal := 4]
ifFalse:
[length := collection first asNumber.
decimal := collection last asNumber].
string := fixedPointValue printString copyUpTo: $s.
index := string findFirst: [:c | c = $.].
index < 1 ifTrue: [index := string size + 1].
decimal - (string size - index) timesRepeat: [string := string , ' '].
JunControlUtility
assert: [stream := String new writeStream]
do:
[length - string size timesRepeat: [stream nextPut: Character space].
stream nextPutAll: (string copyFrom: 1 to: (length min: string size)).
string := stream contents]
ensure: [stream close].
^string