Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • vala vala
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 776
    • Issues 776
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 70
    • Merge requests 70
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GNOMEGNOME
  • valavala
  • Merge requests
  • !126

Map empty start/end index to 0/length for slice expressions

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged wb9688 requested to merge wb9688/vala:string-slice-0 into master May 21, 2020
  • Overview 8
  • Commits 1
  • Pipelines 0
  • Changes 4

This allows doing the following:

public static int main (string[] args) {
    string a = "appelflap";
    stdout.printf ("%s\n", a[-4:]); // flap
    stdout.printf ("%s\n", a[:5]);  // appel
    stdout.printf ("%s\n", a[:]);   // appelflap
    return 0;
}

Fixes #238 (closed)

Edited May 26, 2020 by Rico Tzschichholz
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: string-slice-0