Appending and Prepending in Yocto - +=, =+ vs .=, =.
Bitbake provides two sets of appending and prepending operators.
1. +=, =+
2. .= , =.
For example,
A = "hello"
A += "world"
C = "good"
C =+ "bye"
The value of A will be "hello world" and C will be "bye good"
So, += is appending and =+ is for prepending. Note, that these operators include an additional space between each call
When we don't need to add space, we can use .=, =. operators. These are mainly used to concatenate strings.
When we use append, prepend, there will be no additional space added, you need to manually provide space.
You can also remove values from the variable using 'remove'.
1. +=, =+
2. .= , =.
For example,
A = "hello"
A += "world"
C = "good"
C =+ "bye"
The value of A will be "hello world" and C will be "bye good"
So, += is appending and =+ is for prepending. Note, that these operators include an additional space between each call
When we don't need to add space, we can use .=, =. operators. These are mainly used to concatenate strings.
When we use append, prepend, there will be no additional space added, you need to manually provide space.
You can also remove values from the variable using 'remove'.
Comments
Post a Comment