-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathIecString.fun
140 lines (123 loc) · 4.09 KB
/
IecString.fun
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
FUNCTION IecStringCopy : DINT (*Copy source to destination up to size of destination or source length*)
VAR_INPUT
destination : STRING[0]; (*Destination string*)
size : UDINT; (*Size of destination*)
source : STRING[0]; (*Source string*)
END_VAR
END_FUNCTION
FUNCTION IecStringConcat : DINT (*Concatenate source to destination up to size of destination or source length*)
VAR_INPUT
destination : STRING[0]; (*Destination string*)
size : UDINT; (*Size of destination*)
source : STRING[0]; (*Source string*)
END_VAR
END_FUNCTION
FUNCTION IecStringCompare : INT (*Compare characters of two strings*)
VAR_INPUT
string1 : STRING[0]; (*First string*)
string2 : STRING[0]; (*Second string*)
characters : UDINT; (*Maximum number of characters to compare*)
END_VAR
END_FUNCTION
FUNCTION IecStringLength : UDINT (*Determine the length of a string*)
VAR_INPUT
source : STRING[0]; (*Source string*)
END_VAR
END_FUNCTION
FUNCTION IecStringFirst : UDINT (*First occurrence of character in source*)
VAR_INPUT
source : STRING[0]; (*Source string*)
character : USINT; (*Search character*)
END_VAR
END_FUNCTION
FUNCTION IecStringLast : UDINT (*Last occurrence of character in source*)
VAR_INPUT
source : STRING[0]; (*Source string*)
character : USINT; (*Search character*)
END_VAR
END_FUNCTION
FUNCTION IecStringFind : UDINT (*Find substring in source*)
VAR_INPUT
source : STRING[0]; (*Source string*)
find : STRING[0]; (*Search string*)
END_VAR
END_FUNCTION
FUNCTION IecStringFirstIn : UDINT (*First occurrence in source of any character from find*)
VAR_INPUT
source : STRING[0]; (*Source string*)
find : STRING[0]; (*Search string*)
END_VAR
END_FUNCTION
FUNCTION IecStringLengthIn : UDINT (*Initial length in source containing only characters from find*)
VAR_INPUT
source : STRING[0]; (*Source string*)
find : STRING[0]; (*Search string*)
END_VAR
END_FUNCTION
FUNCTION IecStringStartsWith : BOOL (*Does source start with prefix*)
VAR_INPUT
source : STRING[0]; (*Source string*)
prefix : STRING[0]; (*Prefix string*)
END_VAR
END_FUNCTION
FUNCTION IecStringEndsWith : BOOL (*Does source end with suffix*)
VAR_INPUT
source : STRING[0]; (*Source string*)
suffix : STRING[0]; (*Suffix string*)
END_VAR
END_FUNCTION
FUNCTION IecStringReplace : DINT (*Find in source and replace in destination*)
VAR_INPUT
destination : STRING[0]; (*Destination string*)
size : UDINT; (*Size of destination*)
source : STRING[0]; (*Source string*)
find : STRING[0]; (*Search string*)
replace : STRING[0]; (*Replace string*)
END_VAR
END_FUNCTION
FUNCTION IecStringSplit : DINT (*Split source into tokens*)
VAR_INPUT
destination : STRING[0]; (*Destination string for first token*)
size : UDINT; (*Size of destination*)
source : STRING[0]; (*Source string*)
delimiters : STRING[0]; (*List of delimiter characters*)
END_VAR
VAR_IN_OUT
address : UDINT; (*Address to the next token in source*)
END_VAR
END_FUNCTION
FUNCTION IecStringFormat : DINT (*Format string with runtime data*)
VAR_INPUT
destination : STRING[0]; (*Destination string*)
size : UDINT; (*Size of destination*)
source : STRING[0]; (*Source string*)
values : IecStringFormatType; (*Format values*)
END_VAR
END_FUNCTION
FUNCTION IecStringDecimal : DINT (*Convert integer to string as decimal*)
VAR_INPUT
destination : STRING[0]; (*Destination string*)
size : UDINT; (*Size of destination*)
value : DINT; (*Signed integer*)
width : USINT; (*Minimum character width*)
flags : USINT; (*Format flags*)
END_VAR
END_FUNCTION
FUNCTION IecStringFloat : DINT (*Convert float to string*)
VAR_INPUT
destination : STRING[0]; (*Destination string*)
size : UDINT; (*Size of destination*)
value : REAL; (*Floating point value*)
width : USINT; (*Minimum character width*)
precision : USINT; (*Decimal precision*)
flags : USINT; (*Format flags*)
END_VAR
END_FUNCTION
FUNCTION IecStringDateTime : DINT (*Format date and/or time*)
VAR_INPUT
destination : STRING[0]; (*Destination string*)
size : UDINT; (*Size of destination*)
value : DTStructure; (*Date time value*)
format : STRING[0]; (*Format string*)
END_VAR
END_FUNCTION