www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10732] New: Example code for std.utf.toUTFindex does not work

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10732

           Summary: Example code for std.utf.toUTFindex does not work
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody puremagic.com
        ReportedBy: k.hara.pg gmail.com



As the title.

import std.utf;
void main()
{
  assert(toUTFindex(`hello world`, 7) == 7);    // doesn't work!
  assert(toUTFindex(`hello world`w, 7) == 7);
  assert(toUTFindex(`hello world`d, 7) == 7);

  assert(toUTFindex(`Ma Chérie`, 6) == 7);      // doesn't work!
  assert(toUTFindex(`Ma Chérie`w, 7) == 7);
  assert(toUTFindex(`Ma Chérie`d, 7) == 7);

  assert(toUTFindex(`さいごの果実 / ミツバチと科学者`, 3) == 9); 
// doesn't work!
  assert(toUTFindex(`さいごの果実 / ミツバチと科学者`w, 9) == 9);
  assert(toUTFindex(`さいごの果実 / ミツバチと科学者`d, 9) == 9);
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 30 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10732


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull



https://github.com/D-Programming-Language/phobos/pull/1443

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 30 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10732




Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/a5ee921f7d2f327e82316de05814ffebda89e201
fix Issue 10732 - Example code for std.utf.toUTFindex does not work

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 31 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10732


Kenji Hara <k.hara.pg gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jul 31 2013