Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[String] add $lastGlue argument to join() methods#33914

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
nicolas-grekas merged 1 commit intosymfony:masterfromnicolas-grekas:s-join
Oct 11, 2019

Conversation

@nicolas-grekas
Copy link
Member

QA
Branch?master
Bug fix?no
New feature?yes
Deprecations?no
Tickets-
LicenseMIT
Doc PR-

An idea that came when reviewingsymfony/symfony-docs#12440

@ro0NL
Copy link
Contributor

unicode defines a start/middle/end part:https://github.com/unicode-org/icu/blob/fd123bf023882f07bfacf51c39111be2f946d8f8/icu4c/source/data/locales/en.txt#L2008-L2019

this was on my list to investigate :) not sure it fits String component, as i was already skeptical about$glue->join($strings) for an API.

ultimately i want to format list values in ICU translation files, but the spec format is missing still :(https://github.com/tc39/proposal-intl-list-format

@nicolas-grekas
Copy link
MemberAuthor

nicolas-grekas commentedOct 8, 2019
edited
Loading

@ro0NL I'm not trying to solve 100% of the problem but the most common that we've all been solving again and again. TC39 is another level of complexity (same reasoning abouttitle(true): it's not linguistically universal, yet it's common enough to deserve being supported out of the box.)

ro0NL reacted with thumbs up emoji

Copy link
Contributor

@ro0NLro0NL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

anyway, i think this feature is fine for non-localized stuff either way 👍

@gharlan
Copy link
Contributor

What do you think about making the method static, like in Java:https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#join-java.lang.CharSequence-java.lang.CharSequence...-

For me, it is a kind of named special constructor for a string (and not a method for doing something with the glue string).
$str = UnicodeString::join($array, $glue, $lastGlue);

@nicolas-grekas
Copy link
MemberAuthor

I think it would make the method harder to discover.

@stof
Copy link
Member

I'm not even sure this should belong to a String component, as it is more about dealing with arrays...

@nicolas-grekas
Copy link
MemberAuthor

@stof Python has it. That's a serious enough precedent to me.

yceruto reacted with thumbs up emoji

nicolas-grekas added a commit that referenced this pull requestOct 11, 2019
…as-grekas)This PR was merged into the 5.0-dev branch.Discussion----------[String] add $lastGlue argument to join() methods| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| Deprecations? | no| Tickets       | -| License       | MIT| Doc PR        | -An idea that came when reviewingsymfony/symfony-docs#12440Commits-------714d629 [String] add $lastGlue argument to join() methods
@nicolas-grekasnicolas-grekas merged commit714d629 intosymfony:masterOct 11, 2019
@nicolas-grekasnicolas-grekas deleted the s-join branchOctober 11, 2019 13:35
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

@OskarStarkOskarStarkOskarStark approved these changes

@ycerutoycerutoyceruto approved these changes

+2 more reviewers

@gharlangharlangharlan approved these changes

@ro0NLro0NLro0NL approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.0

Development

Successfully merging this pull request may close these issues.

8 participants

@nicolas-grekas@ro0NL@gharlan@stof@javiereguiluz@OskarStark@yceruto@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp