当前位置:网站首页>U++ iterative Sorting Query learning notes
U++ iterative Sorting Query learning notes
2022-06-22 14:53:00 【It's a bald rabbit】
iteration
AUTO:
FString JoinedStr;
for (auto& Str : StrArr)
{
JoinedStr += Str;
JoinedStr += TEXT(" ");
}
// JoinedStr == "Hello Brave World of Tomorrow ! "Index:
for (int32 Index = 0; Index != StrArr.Num(); ++Index)
{
JoinedStr += StrArr[Index];
JoinedStr += TEXT(" ");
}Iterator:
for (auto It = StrArr.CreateConstIterator(); It; ++It)
{
JoinedStr += *It;
JoinedStr += TEXT(" ");
}Sort
Sort:
StrArr.Sort();
// StrArr == ["!","Brave","Hello","of","Tomorrow","World"]Lambda Declare collation ( Unstable ordering ,Sort For a quick row + Stack row + Insert ( According to the sorting depth of quick row disassembly, select whether to use quick row or heap row or insert row , I won't go into details here , You can go to see if you are interested sort Source code implementation )):
StrArr.Sort([](const FString& A, const FString& B) {
return A.Len() < B.Len();
});
// StrArr == ["!","of","Hello","Brave","World","Tomorrow"]Heap sort use Lambda Declare collation ( Stable sequencing ):
StrArr.HeapSort([](const FString& A, const FString& B) {
return A.Len() < B.Len();
});
// StrArr == ["!","of","Hello","Brave","World","Tomorrow"]Stable sequencing (StableSort) Use Lambda Declare collation :
StrArr.StableSort([](const FString& A, const FString& B) {
return A.Len() < B.Len();
});
// StrArr == ["!","of","Brave","Hello","World","Tomorrow"]Inquire about
Num():
int32 Count = StrArr.Num();
// Count == 6GetData(): The personal guess is that the operator is overloaded and then for Loop assignment
FString* StrPtr = StrArr.GetData();
// StrPtr[0] == "!"
// StrPtr[1] == "of"
// ...
// StrPtr[5] == "Tomorrow"
// StrPtr[6] - undefined behaviorGetTypeSize(): The number of access elements byte
uint32 ElementSize = StrArr.GetTypeSize();
// ElementSize == sizeof(FString)Operator overloading operator[]: Can get FString * Subscript content of type
FString Elem1 = StrArr[1];
// Elem1 == "of"isValidIndex(int): Pass invalid index ( Less than 0 Or greater than or equal to Num()) Will cause runtime errors .
bool bValidM1 = StrArr.IsValidIndex(-1);
bool bValid0 = StrArr.IsValidIndex(0);
bool bValid5 = StrArr.IsValidIndex(5);
bool bValid6 = StrArr.IsValidIndex(6);
// bValidM1 == false
// bValid0 == true
// bValid5 == true
// bValid6 == falseToUpper():
StrArr[3] = StrArr[3].ToUpper();
// StrArr == ["!","of","Brave","HELLO","World","Tomorrow"]Last() & Top() & Last(int) & Top(int): These two functions are the same , It starts with the last bit of the array
FString ElemEnd = StrArr.Last();
FString ElemEnd0 = StrArr.Last(0);
FString ElemEnd1 = StrArr.Last(1);
FString ElemTop = StrArr.Top();
// ElemEnd == "Tomorrow"
// ElemEnd0 == "Tomorrow"
// ElemEnd1 == "World"
// ElemTop == "Tomorrow"Contain(value): Whether the array contains value value
bool bHello = StrArr.Contains(TEXT("Hello"));
bool bGoodbye = StrArr.Contains(TEXT("Goodbye"));
// bHello == true
// bGoodbye == false Find(value): We can use Find Function family find element . To check if an element exists and return its index .
int32 Index;
if (StrArr.Find(TEXT("Hello"), Index))
{
// Index == 3
}FindLast(value): If there are repeating elements , And we want to find the index of the last element .
int32 IndexLast;
if (StrArr.FindLast(TEXT("Hello"), IndexLast))
{
// IndexLast == 3, because there aren't any duplicates
}Find And FIndLast If the specified value is not found, a special return value will be returned (INDEX_NONE):
int32 Index2 = StrArr.Find(TEXT("Hello"));
int32 IndexLast2 = StrArr.FindLast(TEXT("Hello"));
int32 IndexNone = StrArr.Find(TEXT("None"));
// Index2 == 3
// IndexLast2 == 3
// IndexNone == INDEX_NONE IndexOfByKey(value):IndexOfByKey Apply to operator==(ElementType, KeyType) Any key type that exists .IndexOfByKey Will return the index of the first found element , perhaps INDEX_NONE If the element is not found :
int32 Index = StrArr.IndexOfByKey(TEXT("Hello"));
// Index == 3
边栏推荐
- OpenVINO CPU加速调研
- 一文彻底弄懂工厂模式(Factory)
- D damage and safety
- Fight, programmer -- Chapter 42 will draw a bow like a full moon, look northwest and shoot Sirius
- Madcap flare 2022, documentation in language or format
- How maxscale handles event status after MariaDB master-slave switchover -handle_ events
- If you want to know the stock account opening discount link, how do you know? Is it safe to open an account online?
- Random forest of machine learning
- Shan Zhiguang, chairman of BSN Development Alliance: DDC can provide the underlying support for the development of China's meta universe industry
- C # WinForm photo album function, picture zooming, dragging, preview Pagination
猜你喜欢

UE4 通过蓝图获取本地文件

Zhongshanshan: engineers after being blasted will take off | ONEFLOW u

网站存在的价值是什么?为什么要搭建独立站

直播出海 | 国内直播间再出爆品,「外卷」全球如何致胜

S7-200SMART与FANUC机器人进行Profinet通信的具体方法和步骤

看完这篇 教你玩转渗透测试靶机Vulnhub——DriftingBlues-5

visual studio开发过程中常见操作

RealNetworks vs. 微软:早期流媒体行业之争

MadCap Flare 2022,语言或格式的文档

Basic usage and FAQs of jasperreport report report generation tool
随机推荐
Loot、USDT
Closure of groovy
位置编码(PE)是如何在Transformers中发挥作用的
封装api时候token的处理
UE4 通过蓝图获取本地文件
【无标题】
Mysql学习笔记2022
加密市场进入寒冬,是“天灾”还是“人祸”?
Data collection: skillfully using Bloom filter to extract data summary
Neuron+ekuiper realizes data collection, cleaning and anti control of industrial Internet of things
数据采集之:巧用布隆过滤器提取数据摘要
【考研攻略】北京交通大学网络空间安全专业2018-2022年考研数据分析
阿里云发布CIPU,对于企业客户意味着什么?
How to compare the size of two dates in unity and C #
Thoroughly understand the builder mode (builder)
How maxscale handles event status after MariaDB master-slave switchover -handle_ events
Common real machine debugging plug-ins for unity commercial games
Kukai TV ADB
基于SSH框架甜品商城管理系统【源码+数据库】
一文彻底弄懂单例模式(Singleton)