Ағылшыншамен салыстырыңыз: абзацты басыңыз — түпнұсқа терезеде ашылады. Абзац астындағы EN түймесі оны мәтін ішінде көрсетеді.
Мазмұны
Кіріспе
Нөлдік ұзындығы бар бірегей жол.
Unique string of length zero
Формалды тіл теориясында бос жол немесе бос сөз – нөлдік ұзындығы бар бірегей жол.
In formal language theory, the empty string, or empty word, is the unique string of length zero.
Бағдарламалау тілдерінде қолдану
Көптеген бағдарламалау тілдерінде, жол – дерек типі. Жолдар әдетте жадтың нақты адрестерінде (мекенжайларында) сақталады. Осылайша, бірдей жол (мысалы, бос жол) жадыда екі немесе одан да көп жерде сақталуы мүмкін. Бұл ретте, жадыда бірнеше бос жол болуы мүмкін, ал формальды теориялық анықтама бойынша, тек бір ғана бос жол болуы керек. Дегенмен, жолдарды салыстыру функциясы осы барлық бос жолдардың бір-біріне тең екенін көрсетеді. Тіпті нөл ұзындығы бар жол да, қолданылатын форматқа байланысты, сақталуы үшін жадты қажет етуі мүмкін. Көптеген бағдарламалау тілдерінде бос жол, null сілтемеден (немесе null көрсеткіштен) өзгеше, себебі null сілтеме ешқандай жолға, тіпті бос жолға да көрсетпейді. Бос жол – заңды жол, және көптеген жол операциялары оның үстінде жұмыс істеуі керек. Кейбір тілдер келесілерді ұқсас түрде қарастырады: бос жолдар, null сілтемелер, бүтін сан 0, қалқыма нүктелік сан 0, логикалық мән false, ASCII символы NUL, немесе басқа да осындай мәндер. Бос жол әдетте басқа жолдар сияқты бейнеленеді. Жолды аяқтаушы символ бар жүзеге асыруларда (null-соңындағы жолдар немесе қарапайым мәтін жолдары), бос жол осы аяқтаушы символдың дереу қолданылуымен көрсетіледі. Жолдың бос екенін тексеру үшін әртүрлі функциялар, әдістер, макростар немесе стильдер бар. λ өрнегі Бағдарламалау тілдері "" C, C#, C++, Go, Haskell, Java, JavaScript, Julia, Lua, M, Objective C (C жолы ретінде), OCaml, Perl, PHP, Python, Ruby, Scala, Standard ML, Swift, Tcl, Visual Basic NET '' APL, Delphi, JavaScript, Lua, MATLAB, Pascal, Perl, PHP, Python, R, Ruby, Smalltalk, SQL символ(0) R {'\0'} C, C++, Objective C (C жолы ретінде) std::string C++ ""s C++ (2014 стандартынан бастап) @"" Objective C (тұрақты NSString нысаны ретінде) [NSString string] Objective C (жаңа NSString нысаны ретінде) qq , Perl str Python %{}% Ruby String::new Rust string.Empty C#, Visual Basic NET String.Make 0 ' ' OCaml {} Tcl [[]] Lua
In most programming languages, strings are a data type. Strings are typically stored at distinct memory addresses (locations). Thus, the same string (for example, the empty string) may be stored in two or more places in memory. In this way, there could be multiple empty strings in memory, in contrast with the formal theory definition, for which there is only one possible empty string. However, a string comparison function would indicate that all of these empty strings are equal to each other. Even a string of length zero can require memory to store it, depending on the format being used. In most programming languages, the empty string is distinct from a null reference (or null pointer) because a null reference points to no string at all, not even the empty string. The empty string is a legitimate string, upon which most string operations should work. Some languages treat some or all of the following in similar ways: empty strings, null references, the integer 0, the floating point number 0, the Boolean value false, the ASCII character NUL, or other such values. The empty string is usually represented similarly to other strings. In implementations with string terminating character (null terminated strings or plain text lines), the empty string is indicated by the immediate use of this terminating character. Different functions, methods, macros, or idioms exist for checking if a string is empty in different languages. λ representation Programming languages "" C, C#, C++, Go, Haskell, Java, JavaScript, Julia, Lua, M, Objective C (as a C string), OCaml, Perl, PHP, Python, Ruby, Scala, Standard ML, Swift, Tcl, Visual Basic NET '' APL, Delphi, JavaScript, Lua, MATLAB, Pascal, Perl, PHP, Python, R, Ruby, Smalltalk, SQL character(0) R {'\0'} C, C++, Objective C (as a C string) std::string C++ ""s C++ (since the 2014 standard) @"" Objective C (as a constant NSString object) [NSString string] Objective C (as a new NSString object) q , qq Perl str Python %{}% Ruby String::new Rust string. Empty C#, Visual Basic NET String. make 0 ' ' OCaml {} Tcl [[]] Lua
Бос жолдар мысалы
Бос тізбек – позициялық санау жүйесінде (кез келген негізде) нөлді синтаксистік тұрғыдан дұрыс бейнелеу болып табылады, онда басты цифрлар болмайды. Бос тізбектің формалды тіл теориясынан тыс стандартты визуализациясы болмағандықтан, нөл саны дәстүрлі түрде 0 ондық цифрымен көрсетіледі. Нөлмен толтырылған жад аймағы, нөлдік соңдамалы тізбек ретінде қарастырылса, бос тізбек болып есептеледі. Мәтіннің бос жолдары бос тізбекті көрсетеді. Бұл екі тізбектелген жол соңынан (EOL) туындауы мүмкін, бұл мәтіндік файлдарда жиі кездеседі, және кейде мәтінді өңдеуде абзацтарды бөлу үшін қолданылады, мысалы, MediaWiki-де.
The empty string is a syntactically valid representation of zero in positional notation (in any base), which does not contain leading zeros. Since the empty string does not have a standard visual representation outside of formal language theory, the number zero is traditionally represented by a single decimal digit 0 instead. Zero filled memory area, interpreted as a null terminated string, is an empty string. Empty lines of text show the empty string. This can occur from two consecutive EOLs, as often occur in text files, and this is sometimes used in text processing to separate paragraphs, e. g. in MediaWiki.