Open Bug 1339112 Opened 7 years ago Updated 2 years ago

add documentation for nsTSubstring::Split

Categories

(Core :: XPCOM, defect, P3)

defect

Tracking

()

Tracking Status
firefox54 --- affected

People

(Reporter: froydnj, Unassigned)

References

Details

I forgot to ask gcp to add this, and it's not immediately obvious what you're supposed to do with this function.  Adding documentation would also be a good place to note that this function doesn't drop empty fields as well.
Somewhat tangential to this bug...

I didn't know nsTSubstring::Split existed*, so I reinvented the wheel:
http://searchfox.org/mozilla-central/source/dom/media/VideoUtils.h#449
Of course I think mine is better! :-)
(It's lazy, memory-efficient, trims items, and optionally skips empty items.)

* Oh, now I see it's very young. I suppose I could be blamed for not advertising my own splitter then, so someone else reinvented it! :-P

And this Split was implemented as part of totally unrelated bug and component (sandboxing), which makes it harder to spot. But then, mine too: I did it as part of a 16-patch video-playback bug. I guess opening new bugs for fly-by needed functionality is too hard!

But seriously:
- String features are not easily discoverable. This one is not yet in the "internal string guide":
https://developer.mozilla.org/en-US/docs/Mozilla/Tech/XPCOM/Guide/Internal_strings
It'd be great if there was a complete feature list somewhere. Time to Doxygen All The Things?

- I'd be happy to integrate my work here, if possible and useful.
(In reply to Gerald Squelart [:gerald] from comment #1)
> - I'd be happy to integrate my work here, if possible and useful.

That would be useful!
Is there any reason the Split is not-const? It would be useful to turn it into const method (:gerald's method seems to be).
:jfkthame filed a bug to make it const - bug 1344555.
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.