Template talk:Str find long

False positives

edit

This template is producing false results after the last edit, as a result, the parameter checks for genre in {{Infobox animanga/Header}} is broken. It should be reverted. 24.49.23.45 (talk) 11:32, 30 August 2012 (UTC)Reply

The problem occurs when there is a hyphen in the search query (ex. shōnen-ai and shōjo-ai) which results in a false negative. Therefore I've reverted the it back to the old code until this has been addressed. —Farix (t | c) 01:31, 3 September 2012 (UTC)Reply
  • Sandbox version could not match "shōjo-ai" in text: Some examples were as follows:
  • {{Str find long |{{lc:Genre of shōnen-ai text}}|shōnen-ai}} → 10
  • {{Str find long/sandbox|{{lc:Genre of shōnen-ai text}}|shōnen-ai}} → 10
  • {{Str find long |{{lc:Genre of shōjo-ai text}}|shōjo-ai}} → 10
  • {{Str find long/sandbox|{{lc:Genre of shōjo-ai text}}|shōjo-ai}} → 10
  • {{Str find long/sandbox|{{lc:Text shōjo-ai text}}|shōjo-ai}} → 6
  • {{Str find long/sandbox|text shōjo-ai more|shōjo-ai}} → 6
I checked to see if there was special treatment for the hyphen "-" to fix the problems, but the bug was in calculating an incorrect length of the text to search, so the search failed for longer strings. -Wikid77 (talk) 20:54, 3 Sep, Wikid77 (talk) 02:51, 4 September 2012 (UTC)Reply

More testing of /sandbox to search longer strings

edit

The following are more tests which confirm the correction (4 September 2012) to match longer strings.

  • Search "hō-hum": {{Str find long/sandbox|text shō-hum more|hō-hum}} → 7
  • Search "hōjo-ai": {{Str find long/sandbox|text xxshōjo-ai more|hōjo-ai}} → 9
  • Search "hōjo-ai": {{Str find long/sandbox|text xxzzshōjo-ai more|hōjo-ai}} → 11
  • Length of string "shōjo-ai": 8
  • Search "shōjo-ai": {{Str find long/sandbox|text xxxshōjo-ai more|shōjo-ai}} → 6
  • Search "xshōjo-ai": {{ Str find long/sandbox|text xxxshōjo-ai more|xshōjo-ai}} → 8
  • Search "ōjo-ai": {{Str find long/sandbox|text xxxshōjo-ai more|ōjo-ai}} → 11
  • Search "jo-ai mo": {{Str find long/sandbox|text xxxshōjo-ai more|jo-ai mo}} → 12
  • Search "shōjo_ai": {{Str find long/sandbox|text xxxshōjo_ai more|shōjo_ai}} → 9 (underbar "_")
  • Search "shojo-ai": {{Str find long/sandbox|text xxxshojo-ai more|shojo-ai}} → 9 (with "o" not "ō")
  • Search "what-ever": {{Str find long/sandbox|....:....1....:....2....:....3....:....4....:....5....:.what-ever else|what-ever}} → 57

This problem had been an extremely bizarre bug, which did not occur with strings in the first 10 columns. -Wikid77 (talk) 02:51, 4 September 2012 (UTC)Reply

So far, no problems with false negatives with the new code. —Farix (t | c) 18:01, 4 September 2012 (UTC)Reply

Template-protected edit request on 29 April 2019

edit
  Moved from Template talk:Str find long/logic

Please remove <noinclude>{{pp-template|small=yes}}</noinclude>, and please append <noinclude>{{documentation}}</noinclude> to allow non-template-editors to develop documentation for this template. The documentation template will automatically handle the protection of the page. Thanks, --DannyS712 (talk) 19:38, 29 April 2019 (UTC)Reply

  Note: I don't think this page is even used now? I have lowered protection. Template:Str find long itself redirects to Template:Str find. — Martin (MSGJ · talk) 21:03, 30 April 2019 (UTC)Reply
@MSGJ: In that case, I'll tag it for TfD instead --DannyS712 (talk) 21:07, 30 April 2019 (UTC)Reply