Content deleted Content added
No edit summary |
Tag: |
||
(22 intermediate revisions by 12 users not shown) | |||
Line 1:
{{WikiProject banner shell|class=Start|
{{WikiProject Computing|importance=low
|science=yes
|science-importance=low
}}
}}
== C/C++ example needs actual code ==
Line 6 ⟶ 13:
:: I've changed the code for the C example. I believe the old example would have leaked memory - for processing large amounts of data, this could cause problems! On a side note, could someone check to make sure I haven't done something dumb while writing this (it compiled and worked in VC++) --[[User:Portej|Portej]] 07:29, 26 September 2007 (UTC)
::: At least for me the example in C does '''NOT''' work. i doubled checked it, but still believe, that i did not make a mistake. the problematic section is shown below. this causes a segmentation fault in my environment (gcc-4.1.3). --[[User:Alex.blackbit|Alex.blackbit]] 18:32, 1 November 2007 (UTC)
<syntaxhighlight lang="c">
if (last != input)
last[1] = 0;
</syntaxhighlight>
:::: Alex, this is with strings that don't need trimming? Yeh, last should have been initialized with ret before the loop. I'm fine with just dropping the code though, if it wasn't just a line count thing. [[User:Nevyn|James Antill]] 16:03, 6 November 2007 (UTC)
----
in AWK better to use those command:
Line 22 ⟶ 39:
return rtrim(ltrim(s));
}
==Keep the functions. Remove just code==
Hi, I think you should remove the "other languages which don't have trim functions" section. They '''don't''' have trim or a close analogue, so they should be trimmed. It is superfluous text at the end of the article that happens to take up more than half the article that is supposed to be on '''trim''' rather than what is not trim. It is quite easy to define trim-like and, by omision what is not trim-like. That section becomes a tutorial on how to write trim in other languages and should be removed or moved to this talk page. Please refer to [[What_Wikipedia_is_not#Wikipedia_is_not_a_manual.2C_guidebook.2C_or_textbook| this]]. --[[User:Paddy3118|Paddy]] 05:32, 10 October 2007 (UTC)
:It's about trim library functions as well as trim algorithms. Most of the examples (except C) are only one or two lines of code (which is probably why they don't have library functions). Hardly a hand-holding instruction manual. Leaving them out is to pretend trimming isn't used in these languages, and removes much of the language-specific discussion. Lastly, the code certainly doesn't belong on the talk page. —[[User:Pengo|Pengo]] 14:26, 10 October 2007 (UTC)
::I see what you mean about the ''short'' examples, and also not transferring them to the talk pages, but that large chunk of C? Surely that should go. --[[User:Paddy3118|Paddy]] 15:32, 10 October 2007 (UTC)
:::Yep, probably. Would be nice to move it to Wikibooks, or at least include a link to an open source implementation of the same thing though. —[[User:Pengo|Pengo]] 06:09, 11 October 2007 (UTC)
:::The only point is that if that trim function was used on a large dataset, with lots of whitespace, it would leak memory at a heck of a rate. Is there anywhere that implementations can go? (someone mentioned wikibooks) <small>—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/203.59.18.181|203.59.18.181]] ([[User talk:203.59.18.181|talk]]) 14:37, 17 October 2007 (UTC)</small><!-- Template:UnsignedIP --> <!--Autosigned by SineBot-->
::I dropped the line count significantly on the C example, and it now doesn't allocate memory. Both of which make it much more likely to resemble a real implementation IMO. --[[User:Nevyn|James Antill]] 05:32, 19 October 2007 (UTC)
:::Thanks, it is more succinct, but the point remains that the C function is showing how to write trim in C which does not have trim. Best to leave it out and rely on the mention of external libraries that give trim functionality as a package. --[[User:Paddy3118|Paddy]] 18:04, 19 October 2007 (UTC)
:I've re-removed the C function, as it seems to be a perennial problem. The other code in the article is well established and used frequently in copy/paste programming. I don't think Wikipedia is the best environment to write new code. It could even be seen as "original research". —[[User:Pengo|Pengo]] 01:08, 2 November 2007 (UTC)
== SAS has a trimmed TRIM ==
the SAS language has a STRIP function, but this only removes the space (ASCII 0x20) characters, not all whitespace. <span style="font-size: smaller;" class="autosigned">—Preceding [[Wikipedia:Signatures|unsigned]] comment added by [[Special:Contributions/165.155.110.5|165.155.110.5]] ([[User talk:165.155.110.5|talk]]) 14:32, 8 February 2011 (UTC)</span><!-- Template:UnsignedIP --> <!--Autosigned by SineBot-->
== External links modified ==
Hello fellow Wikipedians,
I have just added archive links to {{plural:1|one external link|1 external links}} on [[Trimming (computer programming)]]. Please take a moment to review [https://en.wikipedia.org/w/index.php?diff=prev&oldid=699922317 my edit]. If necessary, add {{tlx|cbignore}} after the link to keep me from modifying it. Alternatively, you can add {{tlx|nobots|deny{{=}}InternetArchiveBot}} to keep me off the page altogether. I made the following changes:
*Added archive https://web.archive.org/20090802041055/http://doc.trolltech.com:80/4.5/qstring.html to http://doc.trolltech.com/4.5/qstring.html#trimmed
When you have finished reviewing my changes, please set the ''checked'' parameter below to '''true''' to let others know.
{{sourcecheck|checked=false}}
Cheers.—[[User:Cyberbot II|<sup style="color:green;font-family:Courier">cyberbot II</sup>]]<small><sub style="margin-left:-14.9ex;color:green;font-family:Comic Sans MS">[[User talk:Cyberbot II|<span style="color:green">Talk to my owner</span>]]:Online</sub></small> 07:23, 15 January 2016 (UTC)
|