Skip to content

String.IndexOf and String.LastIndexOf throw ArgumentOutOfRangeException if string is string.Empty  #1404

Closed
nanoframework/nf-interpreter
#2826
@CoryCharlton

Description

@CoryCharlton

Library/API/IoT binding

nanoFramework.CoreLibrary

Visual Studio version

No response

.NET nanoFramework extension version

No response

Target name(s)

No response

Firmware version

No response

Device capabilities

No response

Description

If the source string is string.Empty an ArgumentOutOfRangeException is thrown

How to reproduce

No response

Expected behaviour

-1 should always be returned if the input is string.Empty (docs)

Screenshots

No response

Sample project or code

var emptyString = string.Empty;
var lastIndexOf = emptyString.LastIndexOf('.');

Aditional information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions