请测试下一个VBA功能,在任何Excel版本中工作:
Function ExtractOldestDate(strD As String) As Date
Dim arrD: arrD = Split(strD, ", ")
Dim i As Long, oldD As Date, arr, compD As Date
oldD = DateSerial(2050, 1, 1)
For i = 0 To UBound(arrD)
arr = Split(arrD(i), "."): compD = DateSerial(CLng(arr(2)), CLng(arr(1)), CLng(arr(0)))
If compD < oldD Then oldD = compD
Next
ExtractOldestDate = oldD
End Function
上述功能将以这种方式处理( date
)字符串,格式为“ dd.mm.m.yyyy”或“ dmyyyyy” 。为了处理不同的字符串格式,应相应地调整 dateSerial
。我基本上是指该字符串中使用过的分离器和日/月/年的位置...
可以在VBA中使用下一个测试 sub
:
Sub testExtrOldD()
Dim strD As String
strD = Range("A1").value
Debug.Print ExtractOldestDate(strD)
End Sub
of as udf,从单元格AS
=ExtractOldestDate(A1)
:保留公式的单元格,必须格式为日期...
因此,您可以在控制器中使用一个方法
protected function withEntities($request)
{
return [
'shipment' => Shipment::query()->find($request->input('shipment_id')),
];
}
,然后在特征中使用该方法
trait HasCrudActions
{
/**
* Display a listing of the resource.
*
* @return Application|Factory|View
*/
public function index(Request $request)
{
return view("{$this->viewPath}.index")
->with($this->withEntities($request));
}
}
我发现了,指定的文件路径应该看起来像:“ $ {path.module}/db.sql”
我相信我已经提出了解决问题的解决方案。我添加了一个异步componentDidmount,并包含asyncstorage.getItem()函数以正确设置设置状态。这样,它仍然是我应用程序的不同组件的全球性,在刷新后,它首先检查一下。
import React, { createContext, Component } from 'react';
import AsyncStorage from '@react-native-async-storage/async-storage';
const SettingsContext = createContext();
export class SettingsProvider extends Component {
state = {
notifications: false,
locationServices: false,
private: false,
darkMode: false,
}
// updates the state of notifications
toggleNotifications = async () => {
await AsyncStorage.setItem('@notifications', JSON.stringify(!this.state.notifications));
this.setState({ notifications: !this.state.notifications });
};
// updates the state of locationServices
toggleLocationServices = async () => {
await AsyncStorage.setItem('@locationServices', JSON.stringify(!this.state.locationServices));
this.setState({ locationServices: !this.state.locationServices });
};
// updates the state of private
togglePrivate = async () => {
await AsyncStorage.setItem('@private', JSON.stringify(!this.state.private));
this.setState({ private: !this.state.private });
};
// updates the state of darkMode
toggleDarkMode = async () => {
await AsyncStorage.setItem('@darkMode', JSON.stringify(!this.state.darkMode));
this.setState({ darkMode: !this.state.darkMode });
};
// retrieves the state of settings from AsyncStorage on intial app startup
async componentDidMount() {
const notificationsStorage= JSON.parse(await AsyncStorage.getItem('@notifications'));
if(notificationsStorage !== null){
this.setState({notifications: notificationsStorage})
}
const locationServicesStorage= JSON.parse(await AsyncStorage.getItem('@locationServices'));
if(locationServicesStorage !== null){
this.setState({locationServices: locationServicesStorage})
}
const privateStorage= JSON.parse(await AsyncStorage.getItem('@private'));
if(privateStorage!== null){
this.setState({private: privateStorage})
}
}
const darkModeStorage= JSON.parse(await AsyncStorage.getItem('@darkMode'));
if(darkModeStorage !== null){
this.setState({darkMode: darkModeStorage})
}
}
render() {
const { notifications, locationServices, private, darkMode } = this.state;
const { toggleNotifications, toggleLocationServices, togglePrivate, toggleDarkMode } = this;
return (
<SettingsContext.Provider value={{ notifications, locationServices, private, darkMode, toggleNotifications, toggleLocationServices, togglePrivate, toggleDarkMode }}>
{this.props.children}
</SettingsContext.Provider>
)
}
}
export default SettingsContext;
const boyDivStyle = {
backgroundColor: "blue",
borderRadius: "25px",
padding: "20px",
width: 1*20 + "px",
}
class App extends Component {
render() {
return(
<>
<p style = {boyDivStyle}>random</p>
<AddHTMLTag/>
</>
)
}
}
class MessageRenderer extends React.Component {
render() {
return(
<>
{this.state.listOfMessages.map((Message) => {
return (<p style = {boyDivStyle}>{Message}</p>)
}
)}
</>
)
}
}
要列举目录中的所有文件,请调用 showdirectorypicker()
。用户在选择器中选择一个目录,然后返回 filesystemdirectoryhandle
,这使您可以枚举并访问目录的文件。
const button = document.getElementById('button');
button.addEventListener('click', async () => {
const dirHandle = await window.showDirectoryPicker();
for await (const entry of dirHandle.values()) {
console.log(entry.kind, entry.name);
}
});
如果您还需要通过 getfile()
访问每个文件,例如获取单个文件尺寸,请在每个结果上依次使用等待
,而是处理所有结果并行文件,例如,通过
Promise.all()
并行。
const button = document.getElementById('button');
button.addEventListener('click', async () => {
const dirHandle = await window.showDirectoryPicker();
const promises = [];
for await (const entry of dirHandle.values()) {
if (entry.kind !== 'file') {
break;
}
promises.push(entry.getFile().then((file) => `${file.name} (${file.size})`));
}
console.log(await Promise.all(promises));
});
尝试一下
SELECT *
FROM TABLE_NAME
WHERE (INET_ATON("193.235.19.255") BETWEEN INET_ATON(ipStart) AND INET_ATON(ipEnd));
我找不到包含原型的解析的JSON文件,但是,我能够从这个网站(我不知道我只能使用Firefox复制一个列)。虽然这不是理想的选择,但总比没有好。这是原型:
void abort(void);
int abs(int n);
double acos(double x);
char *asctime(const struct tm *time);
char *asctime_r (const struct tm *tm, char *buf);
double asin(double x);
void assert(int expression);
double atan(double x);
double atan2(double y, double x);
int atexit(void (*func)(void));
double atof(const char *string);
int atoi(const char *string);
long int atol(const char *string);
void *bsearch(const void *key, const void *base, size_t num, size_t size, int (*compare) (const void *element1, const void *element2));
wint_t btowc(int c);
void *calloc(size_t num, size_t size);
int catclose (nl_catd catd);
char *catgets(nl_catd catd, int set_id, int msg_id, const char *s);
nl_catd catopen (const char *name, int oflag);
double ceil(double x);
void clearerr(FILE *stream);
clock_t clock(void);
double cos(double x);
double cosh(double x);
char *ctime(const time_t *time);
char *ctime64(const time64_t *time);
char *ctime_r(const time_t *time, char *buf);
char *ctime64_r(const time64_t *time, char *buf);
double difftime(time_t time2, time_t time1);
double difftime64(time64_t time2, time64_t time1);
div_t div(int numerator, int denominator);
double erf(double x);
double erfc(double x);
void exit(int status);
double exp(double x);
double fabs(double x);
int fclose(FILE *stream);
FILE *fdopen(int handle, const char *type);
int feof(FILE *stream);
int ferror(FILE *stream);
int fflush(FILE *stream);
int fgetc(FILE *stream);
int fgetpos(FILE *stream, fpos_t *pos);
char *fgets(char *string, int n, FILE *stream);
wint_t fgetwc(FILE *stream);
wchar_t *fgetws(wchar_t *wcs, int n, FILE *stream);
int fileno(FILE *stream);
double floor(double x);
double fmod(double x, double y);
FILE *fopen(const char *filename, const char *mode);
int fprintf(FILE *stream, const char *format-string, arg-list);
int fputc(int c, FILE *stream);
int fputs(const char *string, FILE *stream);
wint_t fputwc(wchar_t wc, FILE *stream);
int fputws(const wchar_t *wcs, FILE *stream);
size_t fread(void *buffer, size_t size, size_t count, FILE *stream);
void free(void *ptr);
FILE *freopen(const char *filename, const char *mode, FILE *stream);
double frexp(double x, int *expptr);
int fscanf(FILE *stream, const char *format-string, arg-list);
int fseek(FILE *stream, long int offset, int origin);
int fsetpos(FILE *stream, const fpos_t *pos);
long int ftell(FILE *stream);
int fwide(FILE *stream, int mode);
int fwprintf(FILE *stream, const wchar_t *format, arg-list);
size_t fwrite(const void *buffer, size_t size,size_t count, FILE *stream);
int fwscanf(FILE *stream, const wchar_t *format, arg-list)
double gamma(double x);
int getc(FILE *stream);
int getchar(void);
char *getenv(const char *varname);
char *gets(char *buffer);
wint_t getwc(FILE *stream);
wint_t getwchar(void);
struct tm *gmtime(const time_t *time);
struct tm *gmtime64(const time64_t *time);
struct tm *gmtime_r (const time_t *time, struct tm *result);
struct tm *gmtime64_r (const time64_t *time, struct tm *result);
double hypot(double side1, double side2);
int isalnum(int c);
int isalpha(int c);
int isascii(int c);
int isblank(int c);
int iscntrl(int c);
int isdigit(int c);
int isgraph(int c);
int islower(int c);
int isprint(int c);
int ispunct(int c);
int isspace(int c);
int isupper(int c);
int iswalnum (wint_t wc);
int iswalpha (wint_t wc);
int iswblank (wint_t wc);
int iswcntrl (wint_t wc);
int iswctype(wint_t wc, wctype_t wc_prop);
int iswdigit (wint_t wc);
int iswgraph (wint_t wc);
int iswlower (wint_t wc);
int iswprint (wint_t wc);
int iswpunct (wint_t wc);
int iswspace (wint_t wc);
int iswupper (wint_t wc);
int iswxdigit (wint_t wc);
int isxdigit(int c);
double j0(double x);
double j1(double x);
double jn(int n, double x);
long int labs(long int n);
double ldexp(double x, int exp);
ldiv_t ldiv(long int numerator, long int denominator);
struct lconv *localeconv(void);
struct tm *localtime(const time_t *timeval);
struct tm *localtime64(const time64_t *timeval);
struct tm *localtime_r (const time_t *timeval, struct tm *result);
struct tm *localtime64_r (const time64_t *timeval, struct tm *result);
double log(double x);
double log10(double x);
void longjmp(jmp_buf env, int value);
void *malloc(size_t size);
int mblen(const char *string, size_t n);
int mbrlen (const char *s, size_t n, mbstate_t *ps);
int mbrtowc (wchar_t *pwc, const char *s, size_t n, mbstate_t *ps);
int mbsinit (const mbstate_t *ps);
size_t mbsrtowc (wchar_t *dst, const char **src, size_t len, mbstate_t *ps);
size_t mbstowcs(wchar_t *pwc, const char *string, size_t n);
int mbtowc(wchar_t *pwc, const char *string, size_t n);
void *memchr(const void *buf, int c, size_t count);
int memcmp(const void *buf1, const void *buf2, size_t count);
void *memcpy(void *dest, const void *src, size_t count);
void *memmove(void *dest, const void *src, size_t count);
void *memset(void *dest, int c, size_t count);
time_t mktime(struct tm *time);
time64_t mktime64(struct tm *time);
double modf(double x, double *intptr);
double nextafter(double x, double y);
long double nextafterl(long double x, long double y);
double nexttoward(double x, long double y);
long double nexttowardl(long double x, long double y);
char *nl_langinfo(nl_item item);
void perror(const char *string);
double pow(double x, double y);
int printf(const char *format-string, arg-list);
int putc(int c, FILE *stream);
int putchar(int c);
int *putenv(const char *varname);
int puts(const char *string);
wint_t putwchar(wchar_t wc, FILE *stream);
wint_t putwchar(wchar_t wc);
void qsort(void *base, size_t num, size_t width, int(*compare)(const void *element1, const void *element2));
_Decimal32 quantized32(_Decimal32 x, _Decimal32 y);
_Decimal64 quantized64(_Decimal64 x, _Decimal64 y);
_Decimal128 quantized128(_Decimal128 x, _Decimal128 y);
int quantexpd32(_Decimal32 x);
int quantexpd64(_Decimal64 x);
int quantexpd128(_Decimal128 x);
__bool__ samequantumd32(_Decimal32 x, _Decimal32 y);
__bool__ samequantumd64(_Decimal64 x, _Decimal64 y);
__bool__ samequantumd128(_Decimal128 x, _Decimal128 y);
int raise(int sig);
int rand(void);
int rand_r(void);
void *realloc(void *ptr, size_t size);
int regcomp(regex_t *preg, const char *pattern, int cflags);
size_t regerror(int errcode, const regex_t *preg, char *errbuf, size_t errbuf_size);
int regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t *pmatch, int eflags);
void regfree(regex_t *preg);
int remove(const char *filename);
int rename(const char *oldname, const char *newname);
void rewind(FILE *stream);
int scanf(const char *format-string, arg-list);
void setbuf(FILE *stream, char *buffer);
int setjmp(jmp_buf env);
char *setlocale(int category, const char *locale);
int setvbuf(FILE *stream, char *buf, int type, size_t size);
void(*signal (int sig, void(*func)(int))) (int);
double sin(double x);
double sinh(double x);
int snprintf(char *outbuf, size_t n, const char*, ...)
int sprintf(char *buffer, const char *format-string, arg-list);
double sqrt(double x);
void srand(unsigned int seed);
int sscanf(const char *buffer, const char *format, arg-list);
int srtcasecmp(const char *string1, const char *string2);
char *strcat(char *string1, const char *string2);
char *strchr(const char *string, int c);
int strcmp(const char *string1, const char *string2);
int strcoll(const char *string1, const char *string2);
char *strcpy(char *string1, const char *string2);
size_t strcspn(const char *string1, const char *string2);
char *strerror(int errnum);
int strfmon (char *s, size_t maxsize, const char *format, ...);
size_t strftime (char *dest, size_t maxsize, const char *format, const struct tm *timeptr);
size_t strlen(const char *string);
int strncasecmp(const char *string1, const char *string2, size_t count);
char *strncat(char *string1, const char *string2, size_t count);
int strncmp(const char *string1, const char *string2, size_t count);
char *strncpy(char *string1, const char *string2, size_t count);
char *strpbrk(const char *string1, const char *string2);
char *strptime (const char *buf, const char *format, struct tm *tm);
char *strrchr(const char *string, int c);
size_t strspn(const char *string1, const char *string2);
char *strstr(const char *string1, const char *string2);
double strtod(const char *nptr, char **endptr);
_Decimal32 strtod32(const char *nptr, char **endptr);
_Decimal64 strtod64(const char *nptr, char **endptr);
_Decimal128 strtod128(const char *nptr, char **endptr);
float strtof(const char *nptr, char **endptr);
char *strtok(char *string1, const char *string2);
char *strtok_r(char *string, const char *seps, char **lasts);
long int strtol(const char *nptr, char **endptr, int base);
long double strtold(const char *nptr, char **endptr);
unsigned long int strtoul(const char *string1, char **string2, int base);
size_t strxfrm(char *string1, const char *string2, size_t count);
int swprintf(wchar_t *wcsbuffer, size_t n, const wchar_t *format, arg-list);
int swscanf (const wchar_t *buffer, const wchar_t *format, arg-list)
int system(const char *string);
double tan(double x);
double tanh(double x);
time_t time(time_t *timeptr);
time64_t time64(time64_t *timeptr);
FILE *tmpfile(void);
char *tmpnam(char *string);
int toascii(int c);
int tolower(int c);
int toupper(int c);
wint_t towctrans(wint_t wc, wctrans_t desc);
wint_t towlower (wint_t wc);
wint_t towupper (wint_t wc);
int ungetc(int c, FILE *stream);
wint_t ungetwc(wint_t wc, FILE *stream);
var_type va_arg(va_list arg_ptr, var_type);
void va_copy(va_list dest, va_list src);
void va_end(va_list arg_ptr);
void va_start(va_list arg_ptr, variable_name);
int vfprintf(FILE *stream, const char *format, va_list arg_ptr);
int vfscanf(FILE *stream, const char *format, va_list arg_ptr);
int vfwprintf(FILE *stream, const wchar_t *format, va_list arg);
int vfwscanf(FILE *stream, const wchar_t *format, va_list arg_ptr);
int vprintf(const char *format, va_list arg_ptr);
int vscanf(const char *format, va_list arg_ptr);
int vsprintf(char *target-string, const char *format, va_list arg_ptr);
int vsnprintf(char *outbuf, size_t n, const char*, va_list);
int vsscanf(const char*buffer, const char *format, va_list arg_ptr);
int vswprintf(wchar_t *wcsbuffer, size_t n, const wchar_t *format, va_list arg);
int vswscanf(const wchar_t *buffer, const wchar_t *format, va_list arg_ptr);
int vwprintf(const wchar_t *format, va_list arg);
int vwscanf(const wchar_t *format, va_list arg_ptr);
int wcrtomb (char *s, wchar_t wchar, mbstate_t *pss);
wchar_t *wcscat(wchar_t *string1, const wchar_t *string2);
wchar_t *wcschr(const wchar_t *string, wchar_t character);
int wcscmp(const wchar_t *string1, const wchar_t *string2);
int wcscoll (const wchar_t *wcs1, const wchar_t *wcs2);
wchar_t *wcscpy(wchar_t *string1, const wchar_t *string2);
size_t wcscspn(const wchar_t *string1, const wchar_t *string2);
size_t wcsftime(wchar_t *wdest, size_t maxsize, const wchar_t *format, const struct tm *timeptr);
size_t wcslen(const wchar_t *string);
struct wcslconv *wcslocaleconv(void);
wchar_t *wcsncat(wchar_t *string1, const wchar_t *string2, size_t count);
int wcsncmp(const wchar_t *string1, const wchar_t *string2, size_t count);
wchar_t *wcsncpy(wchar_t *string1, const wchar_t *string2, size_t count);
wchar_t *wcspbrk(const wchar_t *string1, const wchar_t *string2);
wchar_t *wcsptime ( const wchar_t *buf, const wchar_t *format, struct tm *tm );
wchar_t *wcsrchr(const wchar_t *string, wchar_t character);
size_t wcsrtombs (char *dst, const wchar_t **src, size_t len, mbstate_t *ps);
size_t wcsspn(const wchar_t *string1, const wchar_t *string2);
wchar_t *wcsstr(const wchar_t *wcs1, const wchar_t *wcs2);
double wcstod(const wchar_t *nptr, wchar_t **endptr);
_Decimal32 wcstod32(const wchar_t *nptr, wchar_t **endptr);
_Decimal64 wcstod64(const wchar_t *nptr, wchar_t **endptr);
_Decimal128 wcstod128(const wchar_t *nptr, wchar_t **endptr);
float wcstof(const wchar_t *nptr, wchar_t **endptr);
wchar_t *wcstok(wchar_t *wcs1, const wchar_t *wcs2, wchar_t **ptr)
long int wcstol(const wchar_t *nptr, wchar_t **endptr, int base);
long double wcstold(const wchar_t *nptr, wchar_t **endptr);
size_t wcstombs(char *dest, const wchar_t *string, size_t count);
unsigned long int wcstoul(const wchar_t *nptr, wchar_t **endptr, int base);
size_t wcsxfrm (wchar_t *wcs1, const wchar_t *wcs2, size_t n);
int wctob(wint_t wc);
int wctomb(char *string, wchar_t character);
wctrans_t wctrans(const char *property);
wctype_t wctype (const char *property);
int wcswidth(const wchar_t *pwcs, size_t n);
wchar_t *wmemchr(const wchar_t *s, wchar_t c, size_t n);
int wmemcmp(const wchar_t *s1, const wchar_t *s2, size_t n);
wchar_t *wmemcpy(wchar_t *s1, const wchar_t *s2, size_t n);
wchar_t *wmemmove(wchar_t *s1, const wchar_t *s2, size_t n);
wchar_t *wmemset(wchar_t *s, wchar_t c, size_t n);
int wprintf(const wchar_t *format, arg-list);
int wscanf(const wchar_t *format, arg-list);
double y0(double x);
double y1(double x);
double yn(int n, double x);
因此,如果我知道您想拥有另一个带有重复和计数的ListView吗?
如果是这样,您可以创建列表&lt;&gt;然后在这种情况下将该项目添加到列表中,我相信是一个字符串,也许是这样的?这只是一个用于演示的控制台应用。
List<string> myList = new List<string>();
myList.Add("One");
myList.Add("Two");
myList.Add("Three");
myList.Add("One");
myList.Add("Two");
myList.Add("Four");
List<string> noDupes = myList.Distinct().ToList();
foreach(string dupe in noDupes)
{
Console.WriteLine(dupe);
}
Console.WriteLine(noDupes.Count());
正如评论者已经提到的那样, arraydeque
不实现 equals()
。如果不确定,请查看javadoc并搜索“平等”。如果它是从“ java.lang.object” class java.lang.object继承的“方法”,那么您知道它使用 Object
's equals equals
实现:
sstatic.net/b5kix.png“ rel =“ nofollow >不能具有 equals()
方法实现,因为Java不允许默认
equals方法。如果类实现多个接口,则每个接口都包含默认的“等于”方法,应使用哪种方法?因此,它是从 Collection
接口继承的。 Javadoc将其列出,因为 Collection
接口将 equals()
用特定于集合的Javadoc定义。
我让它起作用 - targetAuditMode = relationTargetMode.not_audited 应添加到buildingInfo模型内的 building 和 disection 和 disection disection 。
在我想审核的模型中:
@Embedded
@AttributeOverrides({
@AttributeOverride(name = "building"),
@AttributeOverride(name = "division"))
})
@Audited
private BuildingInfo buildingInfo;
在BuildingInfo模型中:
@Embeddable
public class BuildingInfo implements Serializable {
@ManyToOne
@JoinColumn
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
private Buidling building;
@ManyToOne
@JoinColumn
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
private Division division;
}
这是一项要求,因为您的活动会声明 intent-filter 。因此,请简单地这样做:
android:exported="true" >
<intent-filter>
...
</intent-filter>
在任何 Intent-filter 声明之前,请添加,您就可以了。
这些方法也需要缩进。
您现在编写代码的方式,Python不考虑您定义的 dog
类的方法。
文档:
当浏览器故意未获取媒体数据时,暂停事件发生。暂停媒体的加载时,触发此事件,暂停媒体下载后暂停,或者出于某些其他原因已暂停。
docs: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/suspend_event
The suspend event occurs when the browser is intentionally not getting media data. This event is triggered when the loading of the media is suspended, suspended means when the download of a media has been completed, or it has been paused for some other reasons
HTMLMediaElement暂停事件是什么意思?