[Pharo-project] [Fwd: Re: [Newbies] Remove trailing spaces of aString]
I just discovered this new "bit of magic" from the Newbies list. My first impression playing with it is that MethodFinder>>methodFor: should be somehow more prominent in Tools>Finder and also in PharoByExample book. Quite a unique feature and demonstration of Smalltalk power for newcomers. cheers -ben Am 2012-04-27 um 17:27 schrieb H. Hirzel:
Hello
I use Squeak 4.3, Update 11860.
I want to remove the trailing spaces and or tabs and LF of a String
something like 'abc '
should just be 'abc'.
If I remember that there was a method in class String to something like this. Is this correct? Is there a package with additional String convenience methods?
you probably want 'abc ' withoutTrailingBlanks You can find that method by evaluating or printing MethodFinder methodFor: { {'abc '} . 'abc' } (a list with arguments {'abc '} and an expected result ( 'abc' )) HTH Best -Tobias _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
If you use Pharo, you can also do that Note that you have to change 'Selector' with 'Example', and then you can type a list of arguments separated by a dot and the expected result. (If you want some inner details, it will do something like methodFor: {_WHAT_YOU_HAVE_ENTER_}) Have fun, Ben On Apr 28, 2012, at 4:00 PM, Ben Coman wrote:
I just discovered this new "bit of magic" from the Newbies list. My first impression playing with it is that MethodFinder>>methodFor: should be somehow more prominent in Tools>Finder and also in PharoByExample book. Quite a unique feature and demonstration of Smalltalk power for newcomers.
cheers -ben
Am 2012-04-27 um 17:27 schrieb H. Hirzel:
Hello I use Squeak 4.3, Update 11860. I want to remove the trailing spaces and or tabs and LF of a String something like 'abc ' should just be 'abc'. If I remember that there was a method in class String to something like this. Is this correct? Is there a package with additional String convenience methods?
you probably want
'abc ' withoutTrailingBlanks
You can find that method by evaluating or printing
MethodFinder methodFor: { {'abc '} . 'abc' } (a list with arguments {'abc '} and an expected result ( 'abc' ))
HTH
Best -Tobias _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Ah. ha... Very Good. For the whole time I've used Pharo the last 12 months I've had a misconception about Examples. I thought they must have been Example coded somewhere like GLMBasicExamples, the MOEaselExamples and these somehow flagged for searching - and that I never got any results because of some lacking implementation. Here is some usability feedback then... 1. The help text in the bottom pane says "for further informations, print 'FinderUI methodFinderExplanation' ". Rather better would be when [Examples] is selected, that bottom pane is filled with "print 'FinderUI methodFinderExplanation". 2. The help text in the bottom pane says "In these four modes, you can also tick the 'Use RegEx' checkbox." might say "In the first four modes and sort [Examples] to appear at the bottom of the list. Actually that text is a carry over from when Pramgas was not an option and only the first three modes had RegEx. 3. The help text in the bottom pane says "The 'Select classes'...." and "The 'All classes'...." but the actual buttons are <Choose Packages> and <All packages> 4. Optional extra, while <Regexp> is selected, put some help text for regular expressions with examples in the bottom pane. I've logged http://code.google.com/p/pharo/issues/detail?id=5733 cheers -ben Benjamin wrote:
If you use Pharo, you can also do that
------------------------------------------------------------------------
------------------------------------------------------------------------
Note that you have to change 'Selector' with 'Example', and then you can type a list of arguments separated by a dot and the expected result. (If you want some inner details, it will do something like methodFor: {_WHAT_YOU_HAVE_ENTER_})
Have fun, Ben
On Apr 28, 2012, at 4:00 PM, Ben Coman wrote:
I just discovered this new "bit of magic" from the Newbies list. My first impression playing with it is that MethodFinder>>methodFor: should be somehow more prominent in Tools>Finder and also in PharoByExample book. Quite a unique feature and demonstration of Smalltalk power for newcomers.
cheers -ben
Am 2012-04-27 um 17:27 schrieb H. Hirzel:
Hello I use Squeak 4.3, Update 11860. I want to remove the trailing spaces and or tabs and LF of a String something like 'abc ' should just be 'abc'. If I remember that there was a method in class String to something like this. Is this correct? Is there a package with additional String convenience methods?
you probably want
'abc ' withoutTrailingBlanks
You can find that method by evaluating or printing
MethodFinder methodFor: { {'abc '} . 'abc' } (a list with arguments {'abc '} and an expected result ( 'abc' ))
HTH
Best -Tobias _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
:) Good idea ;) I will do that, it shouldn't be so difficult ^^ Ben On Apr 29, 2012, at 5:00 AM, Ben Coman wrote:
Ah. ha... Very Good. For the whole time I've used Pharo the last 12 months I've had a misconception about Examples. I thought they must have been Example coded somewhere like GLMBasicExamples, the MOEaselExamples and these somehow flagged for searching - and that I never got any results because of some lacking implementation.
Here is some usability feedback then...
1. The help text in the bottom pane says "for further informations, print 'FinderUI methodFinderExplanation' ". Rather better would be when [Examples] is selected, that bottom pane is filled with "print 'FinderUI methodFinderExplanation". 2. The help text in the bottom pane says "In these four modes, you can also tick the 'Use RegEx' checkbox." might say "In the first four modes and sort [Examples] to appear at the bottom of the list. Actually that text is a carry over from when Pramgas was not an option and only the first three modes had RegEx.
3. The help text in the bottom pane says "The 'Select classes'...." and "The 'All classes'...." but the actual buttons are <Choose Packages> and <All packages>
4. Optional extra, while <Regexp> is selected, put some help text for regular expressions with examples in the bottom pane.
I've logged http://code.google.com/p/pharo/issues/detail?id=5733
cheers -ben
Benjamin wrote:
If you use Pharo, you can also do that
------------------------------------------------------------------------
------------------------------------------------------------------------
Note that you have to change 'Selector' with 'Example', and then you can type a list of arguments separated by a dot and the expected result. (If you want some inner details, it will do something like methodFor: {_WHAT_YOU_HAVE_ENTER_})
Have fun, Ben
On Apr 28, 2012, at 4:00 PM, Ben Coman wrote:
I just discovered this new "bit of magic" from the Newbies list. My first impression playing with it is that MethodFinder>>methodFor: should be somehow more prominent in Tools>Finder and also in PharoByExample book. Quite a unique feature and demonstration of Smalltalk power for newcomers.
cheers -ben
Am 2012-04-27 um 17:27 schrieb H. Hirzel:
Hello I use Squeak 4.3, Update 11860. I want to remove the trailing spaces and or tabs and LF of a String something like 'abc ' should just be 'abc'. If I remember that there was a method in class String to something like this. Is this correct? Is there a package with additional String convenience methods?
you probably want
'abc ' withoutTrailingBlanks
You can find that method by evaluating or printing
MethodFinder methodFor: { {'abc '} . 'abc' } (a list with arguments {'abc '} and an expected result ( 'abc' ))
HTH
Best -Tobias _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
Ben the original UIFinder was showing the methods effectively executed using a * and the implementors without. Now when you show the results you do not distinguish any of them. Stef On Apr 29, 2012, at 1:42 PM, Benjamin wrote:
:)
Good idea ;) I will do that, it shouldn't be so difficult ^^
Ben
On Apr 29, 2012, at 5:00 AM, Ben Coman wrote:
Ah. ha... Very Good. For the whole time I've used Pharo the last 12 months I've had a misconception about Examples. I thought they must have been Example coded somewhere like GLMBasicExamples, the MOEaselExamples and these somehow flagged for searching - and that I never got any results because of some lacking implementation.
Here is some usability feedback then...
1. The help text in the bottom pane says "for further informations, print 'FinderUI methodFinderExplanation' ". Rather better would be when [Examples] is selected, that bottom pane is filled with "print 'FinderUI methodFinderExplanation". 2. The help text in the bottom pane says "In these four modes, you can also tick the 'Use RegEx' checkbox." might say "In the first four modes and sort [Examples] to appear at the bottom of the list. Actually that text is a carry over from when Pramgas was not an option and only the first three modes had RegEx.
3. The help text in the bottom pane says "The 'Select classes'...." and "The 'All classes'...." but the actual buttons are <Choose Packages> and <All packages>
4. Optional extra, while <Regexp> is selected, put some help text for regular expressions with examples in the bottom pane.
I've logged http://code.google.com/p/pharo/issues/detail?id=5733
cheers -ben
Benjamin wrote:
If you use Pharo, you can also do that
------------------------------------------------------------------------
------------------------------------------------------------------------
Note that you have to change 'Selector' with 'Example', and then you can type a list of arguments separated by a dot and the expected result. (If you want some inner details, it will do something like methodFor: {_WHAT_YOU_HAVE_ENTER_})
Have fun, Ben
On Apr 28, 2012, at 4:00 PM, Ben Coman wrote:
I just discovered this new "bit of magic" from the Newbies list. My first impression playing with it is that MethodFinder>>methodFor: should be somehow more prominent in Tools>Finder and also in PharoByExample book. Quite a unique feature and demonstration of Smalltalk power for newcomers.
cheers -ben
Am 2012-04-27 um 17:27 schrieb H. Hirzel:
Hello I use Squeak 4.3, Update 11860. I want to remove the trailing spaces and or tabs and LF of a String something like 'abc ' should just be 'abc'. If I remember that there was a method in class String to something like this. Is this correct? Is there a package with additional String convenience methods?
you probably want
'abc ' withoutTrailingBlanks
You can find that method by evaluating or printing
MethodFinder methodFor: { {'abc '} . 'abc' } (a list with arguments {'abc '} and an expected result ( 'abc' ))
HTH
Best -Tobias _______________________________________________ Beginners mailing list Beginners@lists.squeakfoundation.org http://lists.squeakfoundation.org/mailman/listinfo/beginners
participants (3)
-
Ben Coman -
Benjamin -
Stéphane Ducasse