I have an application where users have been bundled with a bunch of text boxes and a bunch of objects I will show these items. Just need to set up a Now I want to implement the global variable that users are able to assign values, or values will change during the execution of the program. And I want the users to be able to use them when filling the properties of an object. My first idea was to select a special character that would mark the beginning of a variable name, and then allow the user character to use himself twice to represent himself. For example, I have a global variable named With this problem, if I have a variable named What will be the simplest possible set of rules to achieve in such a way that the user will be able to represent every possible string without any ambiguity? Ideally, variable names can contain any characters, but I can restrict their names to the set set of characters. Your approach to mark both the beginning and end of The easiest way I can think of to avoid this problem I am using one to start the symbol for the beginning and the second for the end (like person object, for which you need to enter the
name and
LastName properties.
Macking . Again, say that I am the symbol marking the beginning of a symbol
% . The user will then be able to enter the name of a person's last name in the form of "Mac. Miking", then I can replace it using the value of
Macking . If the value of
Macking is "Donald", then finally "Mac Donald" will be created.
that and the other
Hello and the user will enter "% Hello" string I Do not know which variable needs to be replaced. I can change my rules, for example, use the "%" symbol to mark the beginning and end of the variable name. But I'm not sure that this would be the cause of any other problem.
% What is the problem if the input string is
% foo %% times% ? Do I get the value of
foo and the value of
bar ? Or do I get the value of
foo% bar ? (Definitely if the
# ) should avoid any ambiguity if the user has a
# Wants it, then it avoids it:
% # . There is no problem with this, because there is no empty variable name (at least I do not expect).
No comments:
Post a Comment