Freelance Project Requests info@CodeDocu.de Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net
#

Solved: conversion from void to non-scalar type String requested bei String.replace und toLowerCase

 

Error message:

 

error: conversion from 'void' to non-scalar type 'String' requested

 

Fehlerzeile, Arduino Original-Code

Original from the websiteArduino.cc -> Tutorial/StringSubstring

String stringTwo = stringOne.replace("<html><head></head><body></body></html>", "Blah");

 

Debug Message

exit status 1

conversion from 'void' to non-scalar type 'String' requested

 

 

Lösung:

No transfer to a zwide variable

   stringTwo.replace("a","b");

 

 

 

 

Solution:

In the case of replace(..) the return istransferred to a second variable, but the result is written back to the variable itself

 

 

  // put your main code here, to run repeatedly:

   String stringOne = "abc";

   String stringTwo = stringOne;

   

   //ok: 

   stringTwo = stringTwo.substring(2);

 

   //ok:

   stringTwo.replace("a","b");

   

   //error:

   //string as result of string.replace(a,b)

   stringTwo = stringOne.replace("a","b");

 

 

Mobile
»
Switch with ESP32 MosFET and high voltages with optocoupler
»
Solved: conversion from void to non-scalar type String requested bei String.replace und toLowerCase
»
Arduino Code: Declare an Enum Type, a Variable and Compare it
»
Connect ESP32 to Bluetooth, work and write and read commands
»
Solved: LCD shows strange signs on ESP32
»
Arduino : switch case

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de