AFC - Abacus Formula Compiler for Java

Strings In AFC

String Functions

Reference to other string
ABC
2Text=C2Text

Numbers as returned by String valued outputs
ABC
30=C30.0
412345.6789...12345.6789
51200000...1200000.0
6123456789...1.23456789E8
70.1...0.1

Booleans are treated as 0/1!
ABCD
81=C8trueExcel says: true
90...falseExcel says: false
101=(C10 = D10)1.01.0Excel says: true
110...1.02.0Excel says: false

Date format is not respected!
ABC
1238032=C1238032.0Excel says: 38032.0

Value conversion with concatenation
ABCD
14Zero is 0=(C14 & " is " & D14)Zero0.0
15Fraction is 12345.6789...Fraction12345.6789
16Exponent is 1200000...Exponent1200000.0
17Integer is 123456789...Integer1.23456789E8
18Percent is 0.1...Percent0.1
19Bool is 1=("Bool is " & C19)trueExcel says: Bool is TRUE
20Bool is 0...falseExcel says: Bool is FALSE
21Bool is 1=("Bool is " & (C21 = D21))1.01.0Excel says: Bool is TRUE
22Bool is 0...1.02.0Excel says: Bool is FALSE

Excel converts date as number too!
ABC
23Date is 38032=("Date is " & C23)38032.0

Plain vs. scientific format with String valued outputs
ABC
2512=D251.012.0
26120...2.0120.0
271200...3.01200.0
2812000...4.012000.0
29120000...5.0120000.0
301200000...6.01200000.0
3112000000...7.01.2E7
32120000000...8.01.2E8
331200000000...9.01.2E9
3412000000000...10.01.2E10
35120000000000...11.01.2E11
361200000000000...12.01.2E12
3712000000000000...13.01.2E13
38120000000000000...14.01.2E14
391200000000000000...15.01.2E15
4012000000000000000...16.01.2E16
41120000000000000000...17.01.2E17
421200000000000000000...18.01.2E18
4312000000000000000000...19.01.2E19
441.2E+20...20.01.2E20
451.2E+21...21.01.2E21
4612340000000000000000...18.01.234E19
471.234E+20...19.01.234E20
48-12340000000000000000...18.0-1.234E19
49-1.234E+20...19.0-1.234E20

Plain vs. scientific format with &
ABCD
51Str 12=("Str " & D51)1.012.0
52Str 120...2.0120.0
53Str 1200...3.01200.0
54Str 12000...4.012000.0
55Str 120000...5.0120000.0
56Str 1200000...6.01200000.0
57Str 12000000...7.01.2E7
58Str 120000000...8.01.2E8
59Str 1200000000...9.01.2E9
60Str 12000000000...10.01.2E10
61Str 120000000000...11.01.2E11
62Str 1200000000000...12.01.2E12
63Str 12000000000000...13.01.2E13
64Str 120000000000000...14.01.2E14
65Str 1200000000000000...15.01.2E15
66Str 12000000000000000...16.01.2E16
67Str 120000000000000000...17.01.2E17
68Str 1200000000000000000...18.01.2E18
69Str 12000000000000000000...19.01.2E19
70Str 1.2E+20...20.01.2E20
71Str 1.2E+21...21.01.2E21
72Str 12340000000000000000...18.01.234E19
73Str 1.234E+20...19.01.234E20
74Str -12340000000000000000...18.0-1.234E19
75Str -1.234E+20...19.0-1.234E20
77Zero is 0=(C77 & " is " & D77)Zero0.0
78Fraction is 12345.6789...Fraction12345.6789
79Exponent is 12000000000...Exponent1.2E10
80Integer is 123456789...Integer1.23456789E8
81Percent is 0.1...Percent0.1
82Date is 38032=("Date is " & C82)38032.0
83Bool is 1=("Bool is " & C83)trueExcel says: Bool is TRUE
84Bool is 0...falseExcel says: Bool is FALSE
85Bool is 1=("Bool is " & (C85 = D85))1.01.0Excel says: Bool is TRUE
86Bool is 0...1.02.0Excel says: Bool is FALSE

Plain vs. scientific format
ABC
88Str 12=("Str " & D88)1.012.0
89Str 120...2.0120.0
90Str 1200...3.01200.0
91Str 12000...4.012000.0
92Str 120000...5.0120000.0
93Str 1200000...6.01200000.0
94Str 12000000...7.01.2E7
95Str 120000000...8.01.2E8
96Str 1200000000...9.01.2E9
97Str 12000000000...10.01.2E10
98Str 120000000000...11.01.2E11
99Str 1200000000000...12.01.2E12
100Str 12000000000000...13.01.2E13
101Str 120000000000000...14.01.2E14
102Str 1200000000000000...15.01.2E15
103Str 12000000000000000...16.01.2E16
104Str 120000000000000000...17.01.2E17
105Str 1200000000000000000...18.01.2E18
106Str 12000000000000000000...19.01.2E19
107Str 1.2E+20...20.01.2E20
108Str 1.2E+21...21.01.2E21

Concatenation operator (&)
ABCDE
2Hello world!=(C2 & " " & D2)Helloworld!
3StartMiddleEnd=(C3 & D3 & E3)StartMiddleEnd
4StartEnd...Start' (empty string)End
5MiddleEnd...' (empty string)MiddleEnd
6StartMiddle...StartMiddle' (empty string)

CONCATENATE
ABCDE
8Hello world!=(C8 & " " & D8)Helloworld!
9StartMiddleEnd=(C9 & D9 & E9)StartMiddleEnd
10StartEnd...Start' (empty string)End
11MiddleEnd...' (empty string)MiddleEnd
12StartMiddle...StartMiddle' (empty string)

CLEAN
ABC
14text=CLEAN( C14 )text
15текст...текст
16text text...text text
17texttext...text text
18texttext...text text
19text... text

LEN
ABCD
215.0=LEN( C21 )Hello
225.0...world
230.0...' (empty string)
245.0...12.34
254.0=LEN( (C25 & D25) )abcd

MID
ABCDE
27abc=MID( C27, D27, E27 )abcdef1.03.0
28a...abcdef1.01.0
29abcde...abcdef1.05.0
30abcdef...abcdef1.06.0
31abcdef...abcdef1.07.0
32...abcdef1.00.0
33b...abcdef2.01.0
34bcde...abcdef2.04.0
35bcdef...abcdef2.05.0
36bcdef...abcdef2.06.0
37...abcdef2.00.0
38f...abcdef6.01.0
39f...abcdef6.02.0
40...abcdef6.00.0
41...abcdef7.01.0
42...abcdef7.00.0
43...' (empty string)1.02.0
44!FE...abcdef0.07.0Excel says: #VALUE!
45!FE...abcdef1.0-1.0Excel says: #VALUE!

LEFT
ABCD
47a=LEFT( C47 )abcdef
48=LEFT( C48, D48 )abcdef0.0
49a...abcdef1.0
50ab...abcdef2.0
51abcde...abcdef5.0
52abcdef...abcdef6.0
53abcdef...abcdef7.0
54...' (empty string)7.0
55!FE...abcdef-1.0Excel says: #VALUE!

RIGHT
ABCD
57f=RIGHT( C57 )abcdef
58=RIGHT( C58, D58 )abcdef0.0
59f...abcdef1.0
60ef...abcdef2.0
61bcdef...abcdef5.0
62abcdef...abcdef6.0
63abcdef...abcdef7.0
64...' (empty string)7.0
65!FE...abcdef-1.0Excel says: #VALUE!

SUBSTITUTE
ABCDEF
67Hello World=SUBSTITUTE( C67, D67, E67 )Hello worldwW
68Hello orld...Hello worldw' (empty string)
69Hello world...Hello world' (empty string)Z
70Hella warld...Hello worldoa
71Heppo world...Hello worldllpp
72Hello worlD!...Hello worlddD!
73Hell wrld...Hello worldo' (empty string)
74Schmello world...Hello worldHSchm
75Hello world...Hello worldll
76Heo word...Hello worldl' (empty string)
77Hello world...Hello worldq' (empty string)
78Hello world...Hello worldqz
79Yes!...Hello worldHello worldYes!
80bAäÄàÀáÁ...aAäÄàÀáÁab
81Yes!...Hello worldHello worldYes!
82...' (empty string)3.05.0
83!FE=SUBSTITUTE( C83, D83, E83, F83 )Hello worldl_0.0Excel says: #VALUE!
84He_lo world...Hello worldl_1.0
85Hel_o world...Hello worldl_2.0
86Hello wor_d...Hello worldl_3.0
87Hello world...Hello worldl_4.0

REPLACE
ABCDEF
89Ah! Hello world=REPLACE( C89, D89, E89, F89 )Hello world1.00.0Ah!
90Schmello world...Hello world1.01.0Schm
91Hello people...Hello world7.05.0people
92Hello people...Hello world7.010.0people
93Hello dear world...Hello world7.00.0dear
94Hello orld...Hello world7.01.0' (empty string)
95Hello Vorld...Hello world7.01.0V
96Hello worldxx...Hello world50.01.0xx
97Hello worldxx...Hello world50.00.0xx
98new...' (empty string)1.04.0new
99!FE...Hello world0.02.0blaExcel says: #VALUE!
100!FE...Hello world1.0-1.0blaExcel says: #VALUE!

EXACT
ABCD
102true=EXACT( C102, D102 )' (empty string)' (empty string)
103false...Hellohello
104true...HelloHello
105false...HelloHellO
106false...' (empty string)a
107false...a' (empty string)
108false...' (empty string)
109false... ' (empty string)
110false...aä
111false...aA
112true...123123.0
113true...123.0123

FIND
ABCDE
1152.0=FIND( C115, D115 )eHello world
1161.0...HHello world
117!FE...XHello worldExcel says: #VALUE!
11811.0...dHello world
1199.0...rHello world
1208.0...orHello world
12110.0...ldHello world
1221.0...Hello worldHello world
1231.0...' (empty string)Hello world
1241.0...' (empty string)' (empty string)
125!FE...x' (empty string)Excel says: #VALUE!
1265.0...aàÀáÁaAäÄ
1276.0...AàÀáÁaAäÄ
1287.0...äàÀáÁaAäÄ
1298.0...ÄàÀáÁaAäÄ
1303.0=FIND( C130, D130, E130 )lHello world2.0
1313.0...lHello world3.0
1324.0...lHello world4.0
13310.0...lHello world5.0
13410.0...lHello world10.0
135!FE...lHello world11.0Excel says: #VALUE!
13611.0...dHello world11.0
137!FE...dHello world12.0Excel says: #VALUE!
1383.0...lloHello world1.0
1393.0...lloHello world3.0
140!FE...lloHello world4.0Excel says: #VALUE!

SEARCH
ABCDE
1422.0=SEARCH( C142, D142 )eHello world
1431.0...HHello world
144!FE...XHello worldExcel says: #VALUE!
14511.0...dHello world
1469.0...rHello world
1478.0...orHello world
14810.0...ldHello world
1491.0...Hello worldHello world
1501.0...' (empty string)Hello world
1512.0...e*oHello world
1525.0...o*lHello world
1538.0...o?lHello world
154!FE...o??lHello worldExcel says: #VALUE!
1555.0...~**~?*~~.Use * or ?, escape with ~.
156!FE...~**~**~~.Use * or ?, escape with ~.Excel says: #VALUE!
1577.0...~o~rUse * or ?, escape with ~.
1588.0...g ~Trailing ~
159!FE...' (empty string)' (empty string)Excel says: #VALUE!
160!FE...x' (empty string)Excel says: #VALUE!
1615.0...aàÀáÁaAäÄ
1625.0...AàÀáÁaAäÄ
1637.0...äàÀáÁaAäÄ
1647.0...ÄàÀáÁaAäÄ
1655.0...ваАбБвВгГ
1665.0...ВаАбБвВгГ
1673.0=SEARCH( C167, D167, E167 )lHello world2.0
1683.0...lHello world3.0
1694.0...lHello world4.0
17010.0...lHello world5.0
17110.0...lHello world10.0
172!FE...lHello world11.0Excel says: #VALUE!
17311.0...dHello world11.0
174!FE...dHello world12.0Excel says: #VALUE!
1753.0...lloHello world1.0
1763.0...lloHello world3.0
177!FE...lloHello world4.0Excel says: #VALUE!
1782.0...e*oHello world1.0
1792.0...e*oHello world2.0
180!FE...e*oHello world3.0Excel says: #VALUE!
1818.0...e*oHello Hello5.0

LOWER
ABC
183hello=LOWER( C183 )HELLO
184hello...Hello
185hello...hellO
186ààááaaää...àÀáÁaAäÄ
187...' (empty string)

UPPER
ABC
189HELLO=UPPER( C189 )HELLO
190HELLO...Hello
191HELLO...hellO
192ÀÀÁÁAAÄÄ...àÀáÁaAäÄ
193...' (empty string)

PROPER
ABC
195This Is A Title=PROPER( C195 )this is a TITLE
1962-Cent'S Worth...2-cent's worth
19776Budget...76BudGet
198Ààá Áaa Ää...àÀá ÁaA äÄ
199Ааб Бвв Ггд Д...АаБ бВв ГгД д

REPT
ABCD
201*abc*abc*abc=REPT( C201, D201 )*abc3.0
202àÀáÁaAäÄ...àÀáÁaAäÄ1.0
203...abc0.0

TRIM
ABC
205aaa bb c=TRIM( C205 ) aaa bb c
206aaa bb c...aaa bb c

MATCH (ascending)
ABCDEF
208!NA=MATCH( C208, D208:F208 )ABDFExcel says: #N/A
2091.0...BBDF
2101.0...CBDF
2112.0...DBDF
2122.0...EBDF
2133.0...FBDF
2143.0...GBDF
2152.0...cACE
2162.0...çACE
2172.0...CDBCD
2181.0...BCBCD

MATCH (descending)
ABCDEF
2203.0=MATCH( C220, D220:F220, (-1.0) )AFDB
2213.0...BFDB
2222.0...CFDB
2232.0...DFDB
2241.0...EFDB
2251.0...FFDB
226!NA...GFDBExcel says: #N/A
2272.0...cECA
2281.0...çECA
2291.0...CDDCB
2302.0...BCDCB

MATCH (equality)
ABCDEF
232!NA=MATCH( C232, D232:F232, 0.0 )ABCDExcel says: #N/A
2331.0...BBCD
2342.0...CBCD
2353.0...DBCD
236!NA...EBCDExcel says: #N/A
2372.0...cBCD
2382.0...cBCC
239!NA...çBCDExcel says: #N/A
2403.0...çBCç
241!NA...CDBCDExcel says: #N/A
242!NA...BCBCDExcel says: #N/A
2432.0...?woOneTwoThree
2441.0...*o*OneTwoThree
2453.0...?hr*OneTwoThree

String Comparisons

Code page not fully supported
ABCD
2true=(C2 < D2)aà
3true...àä
4false...äbExcel says: true

Case insensitive
ABCD
6true=(C6 < D6)Ab
7true...aB

Strings are always greater than numbers
ABCD
9false=(C9 = D9)1010.0
10false=(C10 < D10)1010.0
11true=(C11 > D11)1010.0
12false=(C12 = D12)10.010
13true=(C13 < D13)10.010
14false=(C14 > D14)10.010
15true...1010.0

Equal (=)
ABCD
17false=(C17 = D17)ab
18false...dc
19true...ee
20false...AAA
21true...AAAA
22false...AAA
23false...AAAB
24false...ABAA
25false...' (empty string)A
26false...A' (empty string)
27true...Aa

Not equal (<>)
ABCD
29true=(C29 <> D29)ab
30true...dc
31false...ee
32true...AAA
33false...AAAA
34true...AAA
35true...AAAB
36true...ABAA
37true...' (empty string)A
38true...A' (empty string)
39false...Aa

Greater than (>)
ABCD
41false=(C41 > D41)ab
42true...dc
43false...ee
44false...AAA
45false...AAAA
46true...AAA
47false...AAAB
48true...ABAA
49false...' (empty string)A
50true...A' (empty string)
51false...Aa

Less than (<)
ABCD
53true=(C53 < D53)ab
54false...dc
55false...ee
56true...AAA
57false...AAAA
58false...AAA
59true...AAAB
60false...ABAA
61true...' (empty string)A
62false...A' (empty string)
63false...Aa

Greater or equal (>=)
ABCD
65false=(C65 >= D65)ab
66true...dc
67true...ee
68false...AAA
69true...AAAA
70true...AAA
71false...AAAB
72true...ABAA
73false...' (empty string)A
74true...A' (empty string)
75true...Aa

Less or equal (<=)
ABCD
77true=(C77 <= D77)ab
78false...dc
79true...ee
80true...AAA
81true...AAAA
82false...AAA
83true...AAAB
84false...ABAA
85true...' (empty string)A
86false...A' (empty string)
87true...Aa