 So strings in Ida are something that really confuses a lot of developers, especially new developers because it with most programming languages you just have string That's it. You just have character That's it Ida gives choices and those choices do not Really line up in the way that most developers would think the Ida string and say C string or C sharp string or Python string are really really different I'm gonna have to start this out by first explaining that Ida separates characters into three different types Ida does use Unicode internally, but it's how they are how the characters are represented that uh It's a little unusual The base character Can represent up to I don't want to put this Essentially the ASCII character set it says if it had an upper limit of of eight bits the wide character is As if it had the upper limit of 16 bits, but the actual characters used are Again Unicode you It's a little bit platform dependent, but You know you could easily be dealing with eight bit characters and then anything that would need the full 16 bits gets the Now what is it what does Unicode call it the it's that little extension thing but Just to say that the next character is going to be represented with you know full 16 bits instead of just eight so it does make use of the UTF the Unicode what is that Unicode transactional format instead of the older USC Because these sound a little bit like they're using USC, but what this has to do with is the The enumeration that's used to represent them and then similarly wide wide character is the full thing so this option while seeming a little bit confusing does allow you to Have a little bit more control over what? How much space this is taking up now Generally speaking, it's a pretty straightforward decision If you're doing like desktop or server-based programming use wide wide character simple as that But Ida has its roots in embedded development Very specifically for military systems, but it's a solid Embedded language and so for embedded systems, especially You don't want to be using these huge things You want to use the absolute? minimum necessary So at least for English-speaking countries or even for most Latin stuff Most Latin based stuff that is Character is enough Wide wide our wide character will use up a little bit more stuff will cover quite a bit of languages throughout the world Without using the full space that a wide wide character will But like I said if you're doing desktop or server programming Wide wide character simple as that you don't even need to think about it the base string Works the same way string is an array of characters Wide string is an array of wide characters wide wide string is an array of wide wide characters Now the way arrays in Ida work are they are of fixed length you cannot make them longer You cannot make them shorter so even though it's not written it is a fixed string and I'm going to refer to that as such throughout the rest of this Now those are the easiest to work with but they do have their roots in Or at least the those involved the less typing Least amount of typing to work with but they do They do have their roots in Ida's embedded history so Well, we'll start this out as just the really simple hello world. I Know I've done tons of other stuff. We're gonna finally do a hello world Just to explain all the different strings Ida has So we're obviously doing it just a desktop thing here. So I'm going to use the Wide wide text I out if you're just working with strings It would just be text I out if you're working with wide strings. It would be wide text I out Then it's just a simple put line Hello world if we want to declare this as a variable instead of a literal we can do We name this whatever Now what I mean by a fixed string is that This length here, which it was able to determine just based on the what what value is assigned to this length cannot change This Variable here can never store a string that is shorter or Longer than this and I can demonstrate this by trying to reassign this So if we do something of the same length say hello I Know hello bacon. I This is fine that that assignment is valid because it's the same length But if we try to do something like hello Everyone can see it complains because the length is totally wrong And we can even try to run this and to very obviously gets a constraint error Because the attempt to assign fails we said while Implicitly we did say that the length would be what is that 11 11 characters and this is definitely longer Similarly, if we try to go shorter This also fails So the string type is generally what you're going to want to use if you're just Directly outputting text or if you're working with embedded environments where saving as much space as possible is important Now if you are coming from other programming languages the string that they provide Does not obviously does not work like this. It can be resized and The reason for that is a little bit of a technical matter I Might do a little deep dive on that in another video Just because not everybody needs to know exactly why that happens It is kind of interesting though But then we also have a Bounded and superbounded string. I'm not gonna get into superbounded know that it's basically the same thing We can use those by calling aida strings and then we're still going to be using wide wide here So it would be wide wide bounded. I think that's the package anyways We'll find out and then the type it provides is unbounded Wide wide string Now similarly if you just needed unbounded string, it's just unbounded string You just remove the wides We do have to do one little thing just because this is a string literal And we want an unbounded string. So this is just to unbounded wide wide string, I think that's everything I haven't worked with these in a while because these are mostly for something else Unbounded wide wide string is undefined. Why? Yep, I have forgotten a few things so I'm gonna go run check Exactly what's in that package and get back to this. Okay, so I think I got it There's actually a generic package inside of this. I like I said, I haven't worked with these in a long time But that generic would need to be instantiated. So let's do And that was called What was that called? I think it was generic or generic-bounded strings And then it would be the length. I think that's what it was Generic-bounded length. No. What? Which column are you complaining about? 17? Oh, is it because this starts with a number? Yeah, so that was just because it started with a number and Now if we use this Why? Why do you do this? All right, let me see why this isn't working now This is probably obvious to most of you. You can tell what I normally work with So then we just need the put line and that was from Sink it's done like this Wait Now I'm getting ahead of myself again for bounded strings when you want to Print them to the console. What you do is convert it back to a Fixed string like this Right we do need that again, so We still needed this I shouldn't have removed this and we do get hello world now unlike with the string We can actually go about this This works because a bounded string sets a maximum length and actually allocates the entire maximum length They might be saying that's not efficient, but that is what databases do Which is one of the biggest reasons to use this type of string? It makes working with the database much easier because you can set the same constraint in your code as you have in your database And so then then you avoid any issues with the database Freaking out sending an error back to you like hey, I can't I can't handle this. This is too long for this specific field The code can catch it ahead of time and that cuts back on network traffic Not to mentions make the application seem more responsive because you're getting the error immediately and the can can handle that As opposed to sending it off and getting the error back. They might be able to tell from the way I Name the string or yeah name the string is This can also be useful for terminal applications. Now a lot of modern terminals, especially have ways of handling Exceeding texts by wrapping them around similar to what we do with word processors and internet browsers and everything else nowadays But you can't always guarantee those types of environments, especially in embedded environments You have really basic terminals that might not implement this or you might have to implement this yourself So setting something like this for a Display where you're doing fixed with Fixed with characters and have a set amount of columns on screen Or if you have something like a tft display if you know how many columns you have on that You can set this and then It'll help you if you enter if you win your code entered to too long of a string it'll warn you about that or if For instance your printing information and that information is generated somehow if you wind up with too much on a line you can handle that exception and You know like wrap around manually yourself It's unfortunate, but let's face it embedded programming. You're implementing a lot of things yourself That's just how it is so these are Obviously not something most people are going to wind up working with but if you do a lot of stuff with databases or fixed with fixed column displays these are Very very useful But then we have like I said, I'm not going to get into the super bounded strings. That's it's Almost the same thing some slight differences if you really need these you can look up the difference. It's not really worth mentioning at least for this but For most people working with strings, especially wanting something that behaves conceptually like the strings from see Python Java Everything else basically What you want is this The unbounded string This refers to a string which is flexible in its size. It can shrink but it can also grow So I'll show two different things one is if you are going to be using a lot of stuff with regular strings You may just want to convert the occasional unbounded string to a regular string and in that case you'd want to still be using the This package and we get that but there's also What was it I think that's what it was called Totally don't remember. Oh wait, let's Move this Holy crap. I remembered it. I've literally never used that package in my life and I've remembered its name. Nice Obviously that is it is not wasn't derived out though But We can reassign this to a shorter string and everything's fine we can even Assign this to a shorter string and then extend on What was a lot longer by not really a lot three characters, but still what was longer than the original String this is totally fine The amount of space that this would use up is quite a bit more flexible It's harder to predict so especially for embedded environments. This is a really bad thing to use but like I had mentioned at the beginning for Desktop and server programming actually no, I didn't mention that I was talking about wide wide for that but Unbounded is extremely useful for desktop and server programming much in the same way where you have memory that you can afford to use up And you also don't have very strict constraints where everything needs to be predicted You're not working with a real-time system at least most of the time on desktops and servers You're just generally trying to get things done efficiently Real-time and deficient aren't quite the same thing real time is more predictable Unbounded strings are not predictable but These have the power the features the flexibility that you would expect to see From a string it is a little bit unwieldy to go about typing this all the time as you can see though for unbounded strings bounded actually has this as well you just have to be careful, but I There is concatenation that can just use a string literal You don't have to convert this to an unbounded string the concatenation handles it internally Hang on somewhere anyone mention here No, that should be good one thing I will just leave off leave mentioned before I wrap up There is a Package I have written the text package. It's literally just that text it all the children packages are for other stuff That does help a lot with handling of text of strings There's a lot of additional concatenation operators that are useful Useful for desktop and server programming specifically you would not Do not use those in an embedded environment. They're gonna cause a lot of You really want to be quite a bit more explicit in a embedded environment, but That package is very useful for heavy text processing on a desktop or server environment So if you're doing a lot with text in Ida and are finding a little quite a bit of this a bit cumbersome That package does make it quite a bit easier Hopefully you found this helpful and Hopefully it's clear which type of string and which type of character you should use when as I know it's quite complicated in Ida There's what a total of 15 No 12 12 different types of strings in Ida and it's pretty heavy but At least for me. I find it pretty straightforward, which you want to use when and I like having the control over which because Really flexible strings in an embedded environment is If you've liked this video if you found it helpful, please give me a thumbs up Also consider subscribing and maybe even hitting that little note notification bell. Oh my god I need to learn to speak better Have a good one