Skip to content

[C++] Add string padding option to determine which side the extra space goes on #28919

Closed

Description

@asfimport

I'm trying to implement R bindings for the compute function "utf8_center" but in cases where there are an odd number of spaces in total, the extra space is added to the left.  However, in R, the extra space is added to the right.

Please can we have another string pad option to determine which side the extra space goes, so I can make the functionality match?

Reporter: Nicola Crane / @thisisnic
Assignee: David Li / @lidavidm

PRs and other links:

Note: This issue was originally created as ARROW-13234. Please see the migration documentation for further details.

Activity

  1. asfimport commented on Jul 1, 2021

    @asfimport
    Author

    Antoine Pitrou / @pitrou:
    In Python, the extra space is added to the right as well. Perhaps we can simply change the C++ behaviour? @lidavidm

  2. asfimport commented on Jul 1, 2021

    @asfimport
    Author

    Antoine Pitrou / @pitrou:

    >>> s = "xxx"
    >>> s.center(5)
    ' xxx '
    >>> s.center(6)
    ' xxx  '
    >>> s.center(7)
    '  xxx  '
  3. asfimport commented on Jul 1, 2021

    @asfimport
    Author

    David Li / @lidavidm:
    I'll change it to put it on the right, yes.

  4. asfimport commented on Jul 1, 2021

    @asfimport
    Author

    Nicola Crane / @thisisnic:
    Awesome, thanks!

  5. asfimport commented on Jul 1, 2021

    @asfimport
    Author

    Antoine Pitrou / @pitrou:
    Issue resolved by pull request 10639
    #10639

  6. added this to the 5.0.0 milestone on Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions