koden Posted January 5, 2007 Report Share Posted January 5, 2007 I have this line that I copy into T6 20120 Malmö I have to use only the city name malmö Sometimes the city name is the only thing that is been copyed. How do I do so, that only city name/or text is back in T6? can i tell the macro to look for text and only copy text and not copy space and numbers? Quote Link to comment Share on other sites More sharing options...
another1one Posted January 5, 2007 Report Share Posted January 5, 2007 Could you do a Modify String, with "Delete part of text"? At least that would work if the number of digits was consistent. Otherwise you'd need to search the string for the space. That brings me to a question, can ME do something like that? Most program languages have a simple function that can return the first instance of a substring/char within a string (or, the first instance after a specified starting point), but come to think of it I don't recall such a function in ME. Much as I love how useful ME is sometimes I'm a little annoyed at it's lack of quite basic programming abilities (hopefully to be amended in later versions.) Quote Link to comment Share on other sites More sharing options...
kevin Posted January 5, 2007 Report Share Posted January 5, 2007 another1one: The command to find the position of a space in the text is: Variable Set Integer %N1% from Position of Text in Variable %T1% koden: If the suggestion that another1one made does not work you could try this: Replace "0" with "" in %T1% Replace "1" with "" in %T1% Replace "2" with "" in %T1% Replace "3" with "" in %T1% Replace "4" with "" in %T1% Replace "5" with "" in %T1% Replace "6" with "" in %T1% Replace "7" with "" in %T1% Replace "8" with "" in %T1% Replace "9" with "" in %T1% You may want to explore the various features built into the Variable commands. Most of these functions are built into the 6 basic commands: Variable Set String Variable Modify StringVariable Set Integer Variable Modify Integer Variable Set Decimal Variable Modify Decimal Combined, these 6 macro commands contain 81 separate functions (including the ones suggested above). Quote Link to comment Share on other sites More sharing options...
another1one Posted January 5, 2007 Report Share Posted January 5, 2007 Cool. I didn't think to look in the integer options. ME has a lot of useful functions, if you know where to look for them. BTW, unrelated, but... are there any plans to add arrays to ME? That's one thing I really miss. Quote Link to comment Share on other sites More sharing options...
koden Posted January 5, 2007 Author Report Share Posted January 5, 2007 Thanks again... I love this program which I use every day. I just need a "ME for dummies" :-)))And if it's in danish it would be nice Quote Link to comment Share on other sites More sharing options...
koden Posted January 15, 2007 Author Report Share Posted January 15, 2007 CODE Replace "0" with "" in %T1% Replace "1" with "" in %T1% Replace "2" with "" in %T1% Replace "3" with "" in %T1% Replace "4" with "" in %T1% Replace "5" with "" in %T1% Replace "6" with "" in %T1% Replace "7" with "" in %T1% Replace "8" with "" in %T1% Replace "9" with "" in %T1% I'm not quit sure what you mean. do you mean that I copy the first number and text into T1 Then i replace 0-9 with "" and I have only text left. But what if there have been only text, and no numbers?? What will macro then do? What about the space between number and text? Space also have not to be copyed... Quote Link to comment Share on other sites More sharing options...
wbeldman Posted January 16, 2007 Report Share Posted January 16, 2007 If the city name is preceded by a space character: //for testing Variable Set String %T1% "20120 Malmö " // Get position of space character in T1 Variable Set Integer %N1% from Position of Text in Variable %T1% // Get position of character after the space Variable Modify Integer: Inc (%N1%) // Copy from T1 to T1: Starting Position: Variable N1, Characters to Copy 100000 // that will also work for shorter variables Variable Modify String: Copy Part of %T1% to %T1% //for testing Text Box Display: %T1% Quote Link to comment Share on other sites More sharing options...
kevin Posted January 16, 2007 Report Share Posted January 16, 2007 do you mean that I copy the first number and text into T1 Then i replace 0-9 with "" and I have only text left.Yes. All numbers will be removed from T1.But what if there have been only text, and no numbers?? What will macro then do?Then only the text will be left.What about the space between number and text?Space also have not to be copyed... Then you can remove the space. There are several ways to do this, including wbeldman's suggestion. If you use wbeldman's method, you may not need to do use the Replace with commands because you could copy from the space to the end of the name. However, you could use the Variable Modify String: Trim %T1% command to remove leading and trailing spaces. Like this: Replace "0" with "" in %T1% Replace "1" with "" in %T1% Replace "2" with "" in %T1% Replace "3" with "" in %T1% Replace "4" with "" in %T1% Replace "5" with "" in %T1% Replace "6" with "" in %T1% Replace "7" with "" in %T1% Replace "8" with "" in %T1% Replace "9" with "" in %T1% Variable Modify String: Trim %T1% This would remove all numbers and then remove spaces at the beginning and end of T1. Quote Link to comment Share on other sites More sharing options...
koden Posted January 17, 2007 Author Report Share Posted January 17, 2007 OK I got it.. I did not know that Variable Modify String: Trim automaticly is deleting all spaces left and right Thanks... Quote Link to comment Share on other sites More sharing options...
koden Posted February 22, 2007 Author Report Share Posted February 22, 2007 I use this Replace "0" with "" in %T1% Replace "1" with "" in %T1% Replace "2" with "" in %T1% Replace "3" with "" in %T1% Replace "4" with "" in %T1% Replace "5" with "" in %T1% Replace "6" with "" in %T1% Replace "7" with "" in %T1% Replace "8" with "" in %T1% Replace "9" with "" in %T1% And it works... But today I have this line: 20120 city he macro remove 201 but 20 is back.... So when T1 is typed there is standing 20city :-) It looks like the macro only remove 1,2,3 a.s.o. one time??? How do i get it to replace ALL numbers, also thoose that are there twice? If i put in one more Replace "2" with "" in %T1% and Replace "0" with "" in %T1% Then it works... :-) But it would be bether if it deleted all numbers... Quote Link to comment Share on other sites More sharing options...
wbeldman Posted February 22, 2007 Report Share Posted February 22, 2007 In the Replace Substring command, did you check the checkbox Replace All Instances? Quote Link to comment Share on other sites More sharing options...
Cory Posted February 22, 2007 Report Share Posted February 22, 2007 Kevin: You can replace with "nothing" and avoid the trim. another1one: Isn't this a European postal code? I think you all do it opposite (and more sensibly if you ask me) from the way we plosition it in the US. If it is it's a fixed number of digits and you can simple delete the appropriate number of characters. Also when dealing with different text issues I've found Variable Set to ASCII Value" useful. This way I can do a mathematical comparison. So instead of having a line for each numeric character I can see if a character's ASCII integer value is within a range. Quote Link to comment Share on other sites More sharing options...
kevin Posted February 22, 2007 Report Share Posted February 22, 2007 You can replace with "nothing" and avoid the trim. Note that in my example all the Replace "x" with "" commands do replace with nothing. However, since the original string given as an example was "20120 Malmö ", after removing the numbers you are left with " Malmö ". This has both a leading and trailing space. The Trim command is a quick and easy way to remove them. I intentionally did not recommend replacing spaces (Replace " " with "") since that would also remove desired embedded spaces if the city name included more than one word. Quote Link to comment Share on other sites More sharing options...
koden Posted February 23, 2007 Author Report Share Posted February 23, 2007 Replace All Instances was the problem....thanks.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.